Variables not passed [PHP]

doominus

New Member
Messages
5
Reaction score
0
Points
0
I wrote a form to gather some info from a user:

<FORM ACTION="handle.php" METHOD=POST>

First Name <INPUT TYPE=TEXT NAME="FirstName" SIZE=20><BR>
Last Name <INPUT TYPE=TEXT NAME="LastName" SIZE=40><BR>

<INPUT TYPE=SUBMIT NAME="SUBMIT" VALUE="Submit!">

</FORM>
Once "Submit" has been clicked, I wanted to output a simple page that just takes the inputted info and displays it on the page in the form of two separate sentences:

<?PHP

print "Your first name is
$FirstName.<BR>\n";
print "Your last name is
$LastName.<BR>\n";

?>
My dilemma is that the info typed in by the user on the first page does not get printed on the second page leaving me with blanks when the value of my variables are meant to be displayed.

I'm probably missing something simple >.<
 

Gouri

Community Paragon
Community Support
Messages
4,565
Reaction score
245
Points
63
to print in php you have to use echo command and to access the POST variables you have to use $_POST["variable name"]

so your php file should be changed. to

<?PHP

echo 'Your first name is'. $_POST["FirstName"]. '<BR>';
echo 'Your last name is'. $_POST["LastName"].'<BR>';

?>
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
The method you used works when the server configuration "register_globals" is ON.

For security reasons, it is usually set to OFF (the default since PHP 4.2).
 
Top