Posted by John Nichel on 04/28/05 22:09
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
Navigation:
[Reply to this message]
|