overlordofevil Posted January 3, 2010 Share Posted January 3, 2010 ok so now I have an issue where I am working with php5 and things aren't working. basically I am using an html form with a hidden value to tell the program what set of code to use but the hidden values aren't being read once I hit the submit button. here is a bit of code <div id='header'><br></div><div id="main"> Please Select the Chapter you would like to access from the list. <form action="home.php" method="POST"> <?php include ("allchapter.inc"); ?> <input type="hidden" name="action" value="actualswitch"> <input type="submit" value="Chapter Switch" name="esubmit"> </form> </div> so after this form is submitted I would get a blank page. I added the following line to home.php to see if the results would change. $action = !empty($_GET['action']) ? $_GET['action'] : 'main'; so now when i submit the form it goes to the main option and not the one I have as a hidden value. any idea why the value wouldn't be passed or why it is not being read? I know this is a simple thing just can't figure it out at the moment. any help is appreciated Thanks Bill Quote Link to comment Share on other sites More sharing options...
Zane Posted January 3, 2010 Share Posted January 3, 2010 use isset($_GET['action']) &&!empty($_GET['action']) for your evaluation instead. $action = yourEvaluation ? $_GET['action'] : 'main'; Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted January 3, 2010 Share Posted January 3, 2010 If you want to send the action value as a $_GET variable, you will need to put it on the end of the URL in the form's action="home.php" attribute - action="home.php?action=actualswitch" Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 3, 2010 Share Posted January 3, 2010 Your form is using the POST method, but you are trying to get the value via the $_GET variable. Either change the form method to GET or use $_POST to obtain the submitted value. Quote Link to comment Share on other sites More sharing options...
Zane Posted January 3, 2010 Share Posted January 3, 2010 If you want to send the action value as a $_GET variable, you will need to put it on the end of the URL in the form's action="home.php" attribute - action="home.php?action=actualswitch" I don't know why I didn't see that the method was POST. PFM has the right answer here Quote Link to comment Share on other sites More sharing options...
overlordofevil Posted January 3, 2010 Author Share Posted January 3, 2010 LOL... now I feel stupid... I can't believe I made that mistake. Thanks for catching it guys I appreciate it... now time to go rewrite all my buttons.. Thanks again Bill 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.