I have a trivial question.
I need to get data from previous page. For example, i am in some kind of category view, and then I could click on button to add new post. I want to get category information to autofill for post.
But, till now, I have only two ideas, how to do that. One - setting session with data in current category view to use it in post page, or getting information from previous category view address information with agent referral.
Any other ideas?
PS Sorry, I didn't mentioned anything about this project at all... This is PHP, and previous and any next pages are in the same project ;)
You can propagate the values through the URL
script.php?var1=val1&var2=val2&var3=val3
from there you can access them in the PHP script with
$var1 = $_GET['var1'];
$var2 = $_GET['var2'];
$var3 = $_GET['var3'];
if you dont want to use the URL you can post to the next page.
<form method="post" action="{next_page}">
<input type="hidden" name="cat" value="{category}" />
<input type="hidden" name="var1" value="val1" />
<input type="hidden" name="var2" value="val2" />
<input type="submit" value="Button_TO_Next_Page" />
</form>
on the next page you would retrieve the values with
$cat= $_POST['cat'];
$var2 = $_POST['var2'];
$var3 = $_POST['var3'];
As you mentioned, you can use the session to hold the current category that the user is in and you wont have to worry about $_GET vs $_POST
$val = $_SESSION['val1'];