Re: Notice: Undefined index

From: Date: Thu, 28 Apr 2005 19:09:24 +0000
Subject: Re: Notice: Undefined index
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-214140@lists.php.net to get a copy of this message
Rob Kapfer wrote:
Hello, This is a new install of PHP 5.0.4 on XP, I'm testing if it's installed correctly with the usual test.htm: <form action="action.php" method="POST"> Your name: <input type="text" name="name" /> Your age: <input type="text" name="age" /> <input type="submit"> </form> Action.php: <?php echo $_POST['name']; echo $_POST['age']; ?> Results: C:\NCC>action.php Notice: Undefined index: name in C:\NCC\action.php on line 2 Notice: Undefined index: age in C:\NCC\action.php on line 3 C:\NCC>
Did you give any value to name and age in your form? Check to see if a variable exists before trying to do something with it... if ( isset ( $_POST['name'] ) ) { echo ( $_POST['name'] ); } -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 john@kegworks.com

« previous php.general (#214140) next »