spacepoet Posted February 21, 2011 Share Posted February 21, 2011 Hi: I am trying to pass/request a Variable/QueryString from one page to another, but it isn't working. Seems like it would be simple, so maybe I am overlooking the obvious. I have the 1st page: <a href="NewCity.php?abbr_state=<?php echo $abbr_state ?>">Insert New City</a> Writes the URL properly - CityList.php?abbr_state=CT The 2nd page: <?php $abbr_state = $_REQUEST['abbr_state']; ?> <form> State: <input type="text" name="abbr_state" value="<?php echo $abbr_state; ?>" readonly=""/><br /> </form> But it does not get the variable/QueryString for "CT" and add it to the form field (it's not the "readonly" causing it). Why? What did I miss? Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted February 21, 2011 Share Posted February 21, 2011 I am pretty sure you need sessions for this Quote Link to comment Share on other sites More sharing options...
Skepsis Posted February 21, 2011 Share Posted February 21, 2011 Change $_REQUEST to $_GET and it should work. You don't need sessions for this if the var is set in the url. Quote Link to comment Share on other sites More sharing options...
spacepoet Posted February 21, 2011 Author Share Posted February 21, 2011 Ahhh ... yes. I got it: State: <input type="text" name="abbr_state" value="<?php echo $_GET['abbr_state'] ?>" readonly /><br /> Thanks for the direction! 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.