html form with some PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
georgehowell
Forum Newbie
Posts: 9
Joined: Fri Apr 23, 2010 8:44 am

html form with some PHP

Post by georgehowell »

hi gurus
i've got this small problem with this HTML form, that the PHP code is appearing unintentionally.
Does any1 know how to hide it?
thanx,georgehowell
input field and submit button showing PHP code
input field and submit button showing PHP code
screenDump.jpg (24.63 KiB) Viewed 395 times
User avatar
phdatabase
Forum Commoner
Posts: 83
Joined: Fri May 28, 2010 10:02 am
Location: Fort Myers, FL

Re: html form with some PHP

Post by phdatabase »

First guess, the page is still an .html extension (page.html)? If so, change it to .php (page.php). Either that or no php on the server - NOT likely. For whatever reason the php interpreter is not being called. Being able to see the code would help.
iansane
Forum Commoner
Posts: 62
Joined: Sun Apr 18, 2010 1:26 pm

Re: html form with some PHP

Post by iansane »

Hey,

Not a guru here. New to this myself but I was having the same affect when having php tag inside a php tag so just in case it may be the same issue.

Wrong way:

Code: Select all

<?php
$var = 'some text';
<input type="text" value="<?php echo $var; ?>" />
?>
Right way:

Code: Select all

<?php
$var = 'some text';
?>

<!--notice php closing tag above so this isn't a php inside a php
<input type="text" value="<?php echo $var; ?>" />

<?php
//more php code if you need it
?>
This may be obvious to you but it wasn't to me so I guess it's worth mentioning.
User avatar
phdatabase
Forum Commoner
Posts: 83
Joined: Fri May 28, 2010 10:02 am
Location: Fort Myers, FL

Re: html form with some PHP

Post by phdatabase »

Yup, that'll do it too.
Post Reply