Page 1 of 1

Problem with php 5.2 and inputs from html

Posted: Wed Mar 17, 2010 3:07 pm
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

Re: Problem with php 5.2 and inputs from html

Posted: Wed Mar 17, 2010 3:11 pm
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()

Re: Problem with php 5.2 and inputs from html

Posted: Wed Mar 17, 2010 4:43 pm
by Questionman
thank you! now seems to work, thanks again for you help :D