note 29517 deleted from tutorial.forms by philip
| From: | philip@php.net | Date: | Thu, 01 May 2003 06:37:02 +0000 |
| Subject: | note 29517 deleted from tutorial.forms by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-47325@lists.php.net to get a copy of this message | ||
[editors note]: This will only work with register_globals on and for security reasons not
recommended. Use $_POST['name'] instead.
To add the both into 1 page correctly you need to add an if else test.
<?php
if(!$Name)
{
// Switch to HTML mode to display form
?>
<form action="action.php" method="post">
Name:
<input type="text" name="Name" size="24">
<input type="submit" value="Submit">
<?php
}else{
?>
Hello <?php echo($Name); ?>
!
<?php
}
?>
notice how the if and else work? the cool part about this is that for each if test you can have it
output different things if they left different fields blank :-)