Forum Moderators: coopster
I am actually having troubles in appending a value to a url. For example, I appended a value like this:
echo "<td ><font color=black><a href=test_date.php?=eventid=$link_date><font color=black> $day </a></td></font>";
The problem is that I cannot echo out $eventid to the the new webpage which is test_date.php. I guest my question is can you treat an appended variable to an url as a regular variable and can you actually echo out the appended variable?
Thanks,
Fib_81
The method used on your next page to echo or use that var would be
echo $_GET['eventid'];
you also have a problem with your syntax in that link
test_date.php?=eventid=$link_date
should be
test_date.php?eventid=$link_date
there was an extra = in there
Thanks for replying. I fixed the problem and it worked. But now I have another problem. I set a session variable to the appended variable. For example:
$_SESSION['x'] =$_GET['eventid'];
I tried to echo out $_SESSION['x'] at another webpage but it did not work. I don't know why that is happening. Is it possible to set a session variable to an appended variable and read that session variable to other pages?
Thanks,
Fib_81
I thought I solved but apparently I did not.
I set my session variable like this:
$_SESSION['test_var']= $_GET['eventid'];
header("Location:./test.php");
Then when I tried to echo the $_SESSION['test_var'] in test.php, I get nothing. I used print_r($_SESSION) to see which session variables are set and I did not see $_SESSION['test_var']. It looks as if $_SESSION['test_var'] was never created or set. Am I am doing something wrong?
I am thinking about just appending a value to the header function that directs user to test.php.