deathdeyfer2002 Posted November 22, 2009 Share Posted November 22, 2009 All- I am trying to pull data from my url. Here is my URL: http://index.php?type=ALL&size=ALL I'm using Type to determine what to display and size to determine how many to show before going to a new page. I have also created a drop down menu: <FORM ACTION=""> <select name="jumpto" onChange='window.location.href= this.form.jumpto.options[this.form.jumpto.selectedIndex].value'> <option selected># Per Page</option> <option value ="index.php?type=&size=ALL">All</option> <option value="index.php?">100</option> <option value="index.php">50</option> <option value="index.php">25</option> </select> </FORM> Now what I want to do is take whatever "type" is currently being viewed and only change the size attribute. So If im on http://index.php?type=A&size=ALL and I select 25 from the drop down, I want the corresponding url to be http://index.php?type=A&size=25. I have been trying many different things and one idea I had was to store the variable in javascript. Here is the code for that: <script type="text/javascript"> var type = "<?echo $_GET['type']; ?>"; //document.write(type); </script> Can't quite figure how how to make that work. Anyone have any ideas? Please Help!! Link to comment https://forums.phpfreaks.com/topic/182530-php-passing-data-from-url/ Share on other sites More sharing options...
Alex Posted November 22, 2009 Share Posted November 22, 2009 Looks like you were on the right track. Try this: <FORM ACTION=""> <select name="jumpto" onChange='window.location.href= this.form.jumpto.options[this.form.jumpto.selectedIndex].value'> <option selected># Per Page</option> <option value ="index.php?type=<?php echo $_GET['type']; ?>&size=ALL">All</option> <option value="index.php?type=<?php echo $_GET['type']; ?>&size=100">100</option> <option value="index.php?type=<?php echo $_GET['type']; ?>&size=50">50</option> <option value="index.phptype=<?php echo $_GET['type']; ?>&size=25">25</option> </select> </FORM> Link to comment https://forums.phpfreaks.com/topic/182530-php-passing-data-from-url/#findComment-963418 Share on other sites More sharing options...
deathdeyfer2002 Posted November 22, 2009 Author Share Posted November 22, 2009 Works like a champ! Thanks Link to comment https://forums.phpfreaks.com/topic/182530-php-passing-data-from-url/#findComment-963487 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.