Page 1 of 1

Could anyone help me in solving a problem with variables ???

Posted: Tue Dec 17, 2002 12:58 pm
by lucyinthesky
Hello !
I am a beginner as far as PHP is concerned and bought a book in order to learn it.
Now I have to face the following problem:
I wrote this html code:
...
...
<FORM ACTION="HandleForm.php" METHOD=POST>
First Name <INPUT TYPE=TEXT NAME="FirstName" SIZE=20><BR>
...
</FORM>
...
I saved this as "form.html" !

Afterwards I wrote the "HandleForm.php":

...
...
<?php
print ("Your first name is $FirstName.<BR>\n");
...
?>
...
According to my book, the file "HandleForm.php" should be able to read the text, which the user has entered and which was sent to it by a submit-button, if you put a $ before the name of the element you have used in the file "form.html" !
But when trying it out I just get the following error-message:
"Undefined Variable: FirstName in c:\....\htdocs\HandleForm.php"...

Could anybody help me, please ????

Posted: Tue Dec 17, 2002 1:02 pm
by BDKR
Try $_POST['FirstName'].

I think there is a sticky note up at the top of the list of posts you may want to read as well.

Cheers,
BDKR

Posted: Tue Dec 17, 2002 1:29 pm
by lucyinthesky
:P Thanks a lot !
LUCYINTHESKY