sparhawks Posted October 6, 2009 Share Posted October 6, 2009 Hello. i am after some coding help, hope someonce can point me in the right direction. Passing variables via HREF and retrieving them with GET. Is there a way of appending multiplevariables to the URL? <a href="?month=January">January</a> <a href="?month=February">February</a> <a href="?day=Monday">Monday</a> <a href="?day=Tuesday">Tuesday</a> eg. If i click the January link above my page will change to index.php?month=January. Then if i click Monday i would like my URL to change to index.php?month=January&day=Monday. Likewise if i have index.php?month=January&day=Monday and then click Tuesday i would like URL to replace day=Monday to day=Tuesday. Is this posssible at all? not sure where to start searching. Quote Link to comment https://forums.phpfreaks.com/topic/176768-adding-replacing-variables-to-the-url/ Share on other sites More sharing options...
corbin Posted October 7, 2009 Share Posted October 7, 2009 <a href="?month=January&day=Monday">January, Monday</a> ??? Quote Link to comment https://forums.phpfreaks.com/topic/176768-adding-replacing-variables-to-the-url/#findComment-932031 Share on other sites More sharing options...
sparhawks Posted October 7, 2009 Author Share Posted October 7, 2009 Sorry my question may have been unclear, your suggestion would work but I would rather keep it dynamic so users can elect to select a Month first, then if they want to drill down further they can select a Day as well. If i group them together as you suggested then i will have to provide a long list of URL's. Ideally i would have a list of URL's January to December, then another list of URL's Monday to Sunday. A User can then select a month (eg. index.php?month=January) then they can select a day (eg. index.php?month=January&day=Monday). Then if they wanted to change month they could choose a new month (eg. index.php?month=February&day=Monday) Quote Link to comment https://forums.phpfreaks.com/topic/176768-adding-replacing-variables-to-the-url/#findComment-932060 Share on other sites More sharing options...
nankoweap Posted October 7, 2009 Share Posted October 7, 2009 you're going to render the calendar each time a month is clicked. this gives you ample opportunity to customize the weekday links. something like: /* you should always get a month parameter. i'd take the time to default this to the current month, but I can't remember how to do that off the top of my head */ $month = 'January'; if (isset($_REQUEST['month']) { $month = $_REQUEST['month']; } ... /* now you can use $month to customize the day links: */ <a href="?month=<?= $month; ?>&day=Monday>Monday</a> <a href="?month=<?= $month; ?>&day=Tuesday>Tuesday</a> Quote Link to comment https://forums.phpfreaks.com/topic/176768-adding-replacing-variables-to-the-url/#findComment-932090 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.