simonp Posted December 12, 2008 Share Posted December 12, 2008 We trying to stop using register_globals but this code we have doesn't work without it. What would we need to change? // only validate form when form is submitted if(isset($submit_button)){ $error_msg=''; if($pagerName=='') { $error_msg.="<li>Please tell us your name</li>"; } if($pagerPhone=='') { $error_msg.="<li>Please tell us telephone number</li>"; } Thanks! Simon Quote Link to comment Share on other sites More sharing options...
revraz Posted December 12, 2008 Share Posted December 12, 2008 What variable doesnt work, $submit_button, $pagerName or $pagerPhone? Quote Link to comment Share on other sites More sharing options...
simonp Posted December 12, 2008 Author Share Posted December 12, 2008 What variable doesnt work, $submit_button, $pagerName or $pagerPhone? not really sure! What I don't get is how PHP knows what any of them are as they are passed from a form?? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted December 12, 2008 Share Posted December 12, 2008 http://us2.php.net/manual/en/function.import-request-variables.php but that is not recommended. instead, assign variables that you want: $submit_button = $_POST['submit_button']; Quote Link to comment Share on other sites More sharing options...
Yesideez Posted December 12, 2008 Share Posted December 12, 2008 You can pass session variables from one page to another. Place session_start() at the start of each file that uses them. http://www.tizag.com/phpT/phpsessions.php Quote Link to comment Share on other sites More sharing options...
simonp Posted December 12, 2008 Author Share Posted December 12, 2008 but that is not recommended. instead, assign variables that you want: $submit_button = $_POST['submit_button']; This worked a treat - I knew it was something simple Thanks all. Simon Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.