PHP code in my form

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
reyes99
Forum Commoner
Posts: 38
Joined: Tue May 22, 2007 10:35 pm

PHP code in my form

Post by reyes99 »

Hi Everyone,

I keep getting my PHP code " <?=$_POST[email]?> " showing up inside my field when I run my form in my browser.

What could be causing this??

Code: Select all

        
<p align="center">E-Mail Address:</td>
<td><p align="center">
<input type="text" name="email" value="<?=$_POST[email]?>">
<font color="#FF0000">* required</font></td>
 
Thanks in advance

Ralph
Attachments
screenshot
screenshot
form.JPG (18.76 KiB) Viewed 136 times
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: PHP code in my form

Post by Syntac »

Never, ever use <? or <?=.
reyes99
Forum Commoner
Posts: 38
Joined: Tue May 22, 2007 10:35 pm

Re: PHP code in my form

Post by reyes99 »

what should I use. I am kind of new to PHP...

Thanks
reyes99
Forum Commoner
Posts: 38
Joined: Tue May 22, 2007 10:35 pm

Re: PHP code in my form

Post by reyes99 »

Thanks Syntac,

I found this on google and it worked.

is it ok to use this?

<input type="text" name="email" value="<?php echo $PHP_SELF;?>">


Thanks

Ralph
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: PHP code in my form

Post by Syntac »

Yes, provided you replace $PHP_SELF with whatever your variable is.
reyes99
Forum Commoner
Posts: 38
Joined: Tue May 22, 2007 10:35 pm

Re: PHP code in my form

Post by reyes99 »

Thank you
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: PHP code in my form

Post by Syntac »

Oh, and one more thing...

Code: Select all

$_POST[email]
should be:

Code: Select all

$_POST["email"]
Post Reply