Jump to content

Sending variables between pages


Rayben

Recommended Posts

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?
Link to comment
https://forums.phpfreaks.com/topic/33876-sending-variables-between-pages/
Share on other sites

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?
if you have the pages stored in the database you can easily add a field that holds a string just like a normal get string

some_var=val&other_var=other

You 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] = $VALUE

I 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.