Page 1 of 1

Form Handling

Posted: Fri May 24, 2002 8:20 am
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

Posted: Fri May 24, 2002 8:25 am
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.

Posted: Fri May 24, 2002 10:17 am
by mbenson
also try...
print("$FirstElement");
I use it for html forms, and it works too
-Mike