Rayben Posted January 12, 2007 Share Posted January 12, 2007 Hi!Here's a bit of code:[code]<?php$month = date("n"); //=1?>The month is: <?php echo $predifined_list_of_months[$month]; //="Januari"?>[/code]Now I want the user to be able to push a right or left arrow to change the month, kind of like looking up a different month in the calender. So I'm thinkin I'll use a link back to the same page with some $_GET info in it. I would however like to avoid using $_GET.Is it possible to send data without cookie, post or get? Quote Link to comment https://forums.phpfreaks.com/topic/33876-sending-variables-between-pages/ Share on other sites More sharing options...
ted_chou12 Posted January 12, 2007 Share Posted January 12, 2007 yeap, get, or you can set sessions, but session gets a bit messy, so i prefer post, just put your variable into the url of the next page:eg. test.php?month=$monthin the next page, just:$month = $_GET['month'];Thats it...Ted Quote Link to comment https://forums.phpfreaks.com/topic/33876-sending-variables-between-pages/#findComment-158979 Share on other sites More sharing options...
redbullmarky Posted January 12, 2007 Share Posted January 12, 2007 to be honest, $_GET is going to be your best bet as ted states (though using $_SESSION would require a page reload of sorts anyway to set it, so not really feasible)do you have any specific reason for wanting to avoid $_GET? Quote Link to comment https://forums.phpfreaks.com/topic/33876-sending-variables-between-pages/#findComment-159029 Share on other sites More sharing options...
Rayben Posted January 19, 2007 Author Share Posted January 19, 2007 Hi!Thanks for the answers.I didn't want to cludder up the adress field hehe.But I found that using $_GET was just too easy to let the cluddering bother me. Quote Link to comment https://forums.phpfreaks.com/topic/33876-sending-variables-between-pages/#findComment-164414 Share on other sites More sharing options...
redbullmarky Posted January 19, 2007 Share Posted January 19, 2007 there are ways of tidying up the URL. Maybe one for another day, but look up mod_rewrite if you're using Apache.... Quote Link to comment https://forums.phpfreaks.com/topic/33876-sending-variables-between-pages/#findComment-164439 Share on other sites More sharing options...
Nameless12 Posted January 19, 2007 Share Posted January 19, 2007 if you have the pages stored in the database you can easily add a field that holds a string just like a normal get stringsome_var=val&other_var=otherYou can split them on the & and then loop through them and split them on the equals sign followed by adding them to the $_GET array$_GET[$NAME] = $VALUEI used this technique to create aliases and shorter links if thats all you are after it should suit you just fine assuming you are using a database Quote Link to comment https://forums.phpfreaks.com/topic/33876-sending-variables-between-pages/#findComment-164506 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.