Re: Form variables not working

From: Date: Sat, 16 Nov 2002 17:10:41 +0000
Subject: Re: Form variables not working
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-124730@lists.php.net to get a copy of this message
On Sunday 17 November 2002 00:36, Chris Jackson wrote: > I am havein troubles gettin my form variables to work. > The "register_globals" in php.ini is set to its default of "off". [snip] > the <?php echo $PHP_SELF ?> dosent print anything in the action of the > form and the Because register globals is disabled you have to use $_SERVER['PHP_SELF'], that's covered in the manual. > echo $_POST["answered"]; on the first run gives an error that says that > "answered" is > an undefined variable. That's because the first time you run it you have not submitted a form yet so it's undefined. Various ways to get around this, most straight forward (IMO) being: if (isset($_post['answered'])) { echo $_post['answered']; } -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* This is a test of the emergency broadcast system. Had there been an actual emergency, then you would no longer be here. */

« previous php.general (#124730) next »