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? Link to comment https://forums.phpfreaks.com/topic/228332-request-variablequerystring-issue/ 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 Link to comment https://forums.phpfreaks.com/topic/228332-request-variablequerystring-issue/#findComment-1177387 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. Link to comment https://forums.phpfreaks.com/topic/228332-request-variablequerystring-issue/#findComment-1177388 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! Link to comment https://forums.phpfreaks.com/topic/228332-request-variablequerystring-issue/#findComment-1177395 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.