RE: [PHP-DB] how do I use same page for submit and results?

From: Date: Thu, 06 Feb 2003 22:33:56 +0000
Subject: RE: [PHP-DB] how do I use same page for submit and results?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-25500@lists.php.net to get a copy of this message
or you can use check for the name of the submit button using a specific SUPERGLOBAL array. e.g. if ( ! empty($_POST["submit"]) ) { /* form was submitted */ } else { /* form hasn't been submitted, show it */ echo '<form name="something" method="post">' .'.... form fields/button goes here ....' .'<input type="submit" name="submit" value="send form">' .'</form>'; } Best to check if a variable exists Using the other method will throw an error: Notice: Undefined index: action in c:\program files\apache group\apache\htdocs\testerr.php on line x... Thanks, Luke Woollard -----Original Message----- From: Joshua Stein [mailto:jcs@rt.fm] Sent: Friday, 7 February 2003 5:29 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] how do I use same page for submit and results? > But now I'm not using anything that I can check except for the > button click. Any ideas how to do this? assign a name to the button and check for that. <input type="submit" name="action" value="Show List"> ... if ($_REQUEST["action"] == "Show List") { /* form was submitted */ ... } else { /* form hasn't been submitted, show it */ ... } -j. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.db (#25500) next »