note 48980 added to tutorial.forms

From: Date: Thu, 13 Jan 2005 18:58:57 +0000
Subject: note 48980 added to tutorial.forms
Groups: php.notes 
Request: Send a blank email to php-notes+get-83211@lists.php.net to get a copy of this message
I just thought it was fun to use... <form action="hello.php" method="post"> <p>Your name: <input type="text" name="name" /></p> <p>Your age: <input type="text" name="age" /></p> <p><input type="submit" /></p> </form> <?php if ($_POST['name'] > " ") { ?> Hi <?php echo $_POST['name']; ?>. <?php } ?> <?php if ($_POST['age'] > 0) { ?> You are <?php echo $_POST['age']; ?> years old. <?php } ?> This makes the form post to itself (where hello.php = $yourpage) and only display output if 'name' contains something and/or 'age' is a positive number. ---- Manual Page -- http://www.php.net/manual/en/tutorial.forms.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48980 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48980&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48980&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48980&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48980&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48980&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48980&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48980&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#83211) next »