newbie post question.

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
npodges
Forum Newbie
Posts: 12
Joined: Tue Aug 12, 2003 5:55 pm

newbie post question.

Post 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
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post 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.
npodges
Forum Newbie
Posts: 12
Joined: Tue Aug 12, 2003 5:55 pm

thanks

Post 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
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Yeah, best to leave register_globals off and use the superglobals like $_GET, $_POST etc..
Post Reply