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

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
lucyinthesky
Forum Newbie
Posts: 2
Joined: Tue Dec 17, 2002 12:58 pm

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

Post 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 ????
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post 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
lucyinthesky
Forum Newbie
Posts: 2
Joined: Tue Dec 17, 2002 12:58 pm

Post by lucyinthesky »

:P Thanks a lot !
LUCYINTHESKY
Post Reply