Page 1 of 1

newbie post question.

Posted: Wed Mar 10, 2004 10:49 pm
by npodges
i started using php a while ago, but quit because i couldnt afford, or find for free, a good mysql php server. now i've got apache set up on my machine, and php and mysql as well..
i had some code that i've used before that i know should work that will not work. i've tried to figure it out myself, but dont know enough. i've got it narrowed down to this:

Code: Select all

<?
if ($submit)&#123;
echo $radio;
&#125;
?>
<form action="<?echo $PHP_SELF?>" method=POST>
<input type="radio" name="radio" value="male"> Male
<input type="radio" name="radio" value="Female"> Female
<input type="submit" name="submit" value="Submit!">
</form>
after submitting a choice on this page, it just reloads, but doesnt display it...
http://68.41.89.22/idiote.php <-- the page itself.

http://68.41.89.22/test.php <-- my phpinfo() page(if that helps)

are there variable or setting i need to change? thanks a lot.
-nick podges

Posted: Wed Mar 10, 2004 10:50 pm
by markl999
It requires register_globals to be On and it's Off by default with PHP => 4.2.0
So either turn register_globals On in php.ini (and restart apache) or even better use $_POST['submit'] where you'd normally use $submit, same for the other posted values.

thanks

Posted: Wed Mar 10, 2004 10:54 pm
by npodges
wow, that makes things a lot better :). thanks.
i changed the variables that way, but would you recommend changing the global settings, or would that be superfluous?
-nick podges

Posted: Wed Mar 10, 2004 10:55 pm
by markl999
Yeah, best to leave register_globals off and use the superglobals like $_GET, $_POST etc..