Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Pass Variable to another script
June 5, 2006, 2:02 pm
rate this thread
is that these scripts use frames and therefore I am able to pass the
variable through the URL. It also does not use forms to set this
variable, so i cannot pass it this way either.
So to simplify I have :
$var1 = value;
echo '<href="script2.php">link to script2</a>';
How can script2 find this value?
Re: Pass Variable to another script
a session variable. The code would look something like:
$_SESSION['var1'] = 'test';
But it would be cleaner if you passed the variable in your link to the
other file like this:
$var1 = 'test';
echo '<href="script2.php?var1=$var1">link to script2</a>';
$var1 = $_GET['var1'];
You could also send it via a form with POST by using hidden fields.
Let me know if you need any further advice.