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

Reply via email to