note 29517 added to tutorial.forms

From: Date: Sun, 16 Feb 2003 06:07:50 +0000
Subject: note 29517 added to tutorial.forms
Groups: php.notes 
Request: Send a blank email to php-notes+get-44045@lists.php.net to get a copy of this message
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($frmName); ?> ! <?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 :-) -- http://www.php.net/manual/en/tutorial.forms.php http://master.php.net/manage/user-notes.php?action=edit+29517 http://master.php.net/manage/user-notes.php?action=delete+29517 http://master.php.net/manage/user-notes.php?action=reject+29517

« previous php.notes (#44045) next »