Page 1 of 1

html form with some PHP

Posted: Sun May 30, 2010 3:00 am
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 394 times

Re: html form with some PHP

Posted: Sun May 30, 2010 10:37 am
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.

Re: html form with some PHP

Posted: Sun May 30, 2010 2:18 pm
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.

Re: html form with some PHP

Posted: Sun May 30, 2010 2:39 pm
by phdatabase
Yup, that'll do it too.