Problem with php 5.2 and inputs from html

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
Questionman
Forum Newbie
Posts: 2
Joined: Wed Mar 17, 2010 3:02 pm

Problem with php 5.2 and inputs from html

Post by Questionman »

Hi every1, im totally lost with this, ill paste and easy example of the problem in having in my server


Lets say i create a testeo.html page with this lines inside:

<form method=POST action="test.php">
<input type="text" name="name">
<input type="submit" name="send">
</form>

now in the test.php i set this:

<?php
echo $name;
?>

this is an easy example of the problem, this wont work on the server, other php lines do but this wont, no error appear or something just white page, wich means its a problem with php getting the input info into a var. this works perfectly on a server with php 4.4, so i just wonder and cant find what im doing wrong. :banghead:

thanks lots for the help
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Re: Problem with php 5.2 and inputs from html

Post by infolock »

it's because register_globals is turned off (by default) for php 5.x... you should use $_POST['name'] to access your variable as i do not condone turning register_globals on (for security reasons).

if you don't want to use $_POST, just use extract()
Questionman
Forum Newbie
Posts: 2
Joined: Wed Mar 17, 2010 3:02 pm

Re: Problem with php 5.2 and inputs from html

Post by Questionman »

thank you! now seems to work, thanks again for you help :D
Post Reply