RE: how to exist within the context?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
<form method=post>
<input name="yourname" type="text" size="20">
<input name="submit" type="submit" value="submit">
</form>

<?php

$submit = $_POST['submit'];
$name = $_POST['yourname'];

if ($submit)
{
    if ($name=="")
   {
     print "Please enter your name!";
     //exit;
   }
}

echo "Continue processing...";
?>
[/snip]

You have to POST the value back to the form. This is one of the harder
concepts to grasp when programming in a stateless environment;

<?php
if(!isset($_POST['yourname'])){
   $theNameValue = 'Please enter your name';
} else {
   $theNameValue = $_POST['yourname'];
}
?>

<form action="<?php echo $PHP_SELF; ?>"method=post>
<input name="yourname" type="text" size="20" value="<?php echo
$_POST['yourname']; ?>">
<input name="submit" type="submit" value="submit">
</form>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux