Re: If... Else.. I'm not getting it!
| From: | Andi Gutmans | Date: | Sat, 25 Jan 2003 10:03:47 +0000 |
| Subject: | Re: If... Else.. I'm not getting it! | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-93667@lists.php.net to get a copy of this message | ||
This list is only for people who develop PHP and not _with_ PHP.
Please contact a PHP users mailing list such as php-general@lists.php.net
Good luck,
Andi
At 10:24 AM 1/25/2003 +0100, Frank Keessen wrote:
Hi all, Please can you help me with the following: If got a little sample code: This one is working (!): <?php $vname=$_POST['vname']; echo "hello $vname"; ?> <form action="<? echo ($_SERVER['PHP_SELF']); ?>" method=post> <table> <tr><td>Input yourname</td><td><input type=text name=vname></td></tr> <tr><td colspan=2><input type=submit name=submit></td></tr> </table> </form> <?php ?> But when i'm using IF Else.. Nothing is happening. I'm only seeing the form but when i submit that form: The $vname doen't display.. Here is the code that doesn't work: <?php $vname=$_POST['vname']; if($submit) { echo "hello $vname"; } else { ?> <form action="<? echo ($_SERVER['PHP_SELF']); ?>" method=post> <table> <tr><td>Input yourname</td><td><input type=text name=vname></td></tr> <tr><td colspan=2><input type=submit name=submit></td></tr> </table> </form> <?php } ?> What am I doing wrong??? Thanks, Frank