Form Handling

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
matt2kjones
Forum Newbie
Posts: 8
Joined: Thu May 23, 2002 3:54 pm

Form Handling

Post by matt2kjones »

Right im new to php, and i have been doing tutorials on a website to learn php, well now im upto form handling and this is what i do

I create a document called form.html and write this code:

<form action="FormHandler.php" method="POST">
<input type="text" name="FirstElement">
<input type="text" name="SecondElement">
<input type="submit" value="Send form">
</form>

Then i create a php file called FormHandler.php and write this code:

<?php
echo($FirstElement);
echo($SecondElement);
?>

So then i run the Form.html file, then submit it. Then i get this error :

Notice: Undefined variable: FirstElement in d:\inetpub\monster.2ya\learn\FormHandler.php on line 2

Notice: Undefined variable: SecondElement in d:\inetpub\monster.2ya\learn\FormHandler.php on line 3


What am i doing wrong. Thanx
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Try:

Code: Select all

<?php 
echo($_POST&#1111;'FirstElement']); 
echo($_POST&#1111;'SecondElement']); 
?>
And look up on $_POST and $_GET variable in the forums around here.
mbenson
Forum Newbie
Posts: 1
Joined: Fri May 24, 2002 10:17 am

Post by mbenson »

also try...
print("$FirstElement");
I use it for html forms, and it works too
-Mike
Post Reply