Passing Variables error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yonibensimon
Forum Newbie
Posts: 15
Joined: Thu Aug 07, 2003 10:24 am

Passing Variables error

Post by yonibensimon »

Hi guys, i read the sticky on passing variables, but i still got errors!

Here is my html file:

<form action="Handler.php" method="POST">
<input type="text" name="text1">
<input type="text" name="text2">
<input type="submit" value="GO">
</form>

And here is the Handler.php file:

<?php
echo $_POST['text1'];
echo $_POST['text2'];
?>

And here is what i get :

PHP Notice: Undefined index: FirstElement in C:\Documents and Settings\jbensimon\Desktop\forum guy\FormHandler.php on line 8 PHP Notice: Undefined index: SecondElement in C:\Documents and Settings\jbensimon\Desktop\forum guy\FormHandler.php on line 9
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

try sticking a

Code: Select all

print_r($_POST);
at the top of your Handler.php page and see what it prints out.
yonibensimon
Forum Newbie
Posts: 15
Joined: Thu Aug 07, 2003 10:24 am

Post by yonibensimon »

I fixed the problem by replacing "post" in the 2 files by "get".

But now i have another problem. All off this work fine in my PHP editor, but on a browser, the php file gives me a blank page !
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Is this the same error posted twice?
Post Reply