Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Help, i have some code which will not work but should!!!

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Help, i have some code which will not work but should!!!

Postby pbrane » Sun Nov 03, 2002 2:38 pm

this is the handleform
<?

/* this page receives and handles the data generated by chapter3.htm */
print ("Your first name is $FirstName.<br>\n");
print ("Your last name is $LastName.<br>\n");
print ("Your E-mail address is $Email.<br>\n");
print ("This is what you had to say:<br>\n $Comments<br>\n");
?>

this is the html

<body>
<center>
<FORM action="HandleForm.php" method="post">
First Name <input type="text" name="FirstName" size=20><br>
Last Name <input type="text" name="LastName" size=40><br>
E-Mail Address <input type="text" name="Email" size=60><br>
Comments <TEXTAREA name="Comments" rows=5 cols=40></textarea><br>
<input type=submit name"Submit" value="submit">
<input type=reset name="reset" value="Reset">
</form>
</center>
</body>
</html>

im getting errors on the data handled but when i add:
$FirstName = $_POST['FirstName']; etc it works i thought PHP did this automaticly

Thanks for your help
:lol: :lol:
pbrane
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sun Nov 03, 2002 2:28 pm
Location: Nottingham UK

Postby Jay » Sun Nov 03, 2002 2:46 pm

You have to use $_POST['FirstName'] instead of $FirstName because PHP now sets the global variable to off (more secure). You can set them on again if you wish (and have root access to your server) but I wouldn't recommend it.

Seeing there's actually a thread on this very subject here I will close this one.
Jay
 


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron