Page 1 of 1

Need help sending url passed variables to an outside file

Posted: Sat Jul 12, 2003 11:26 pm
by johnm1019
Hello, my first post so here we go.....

On my site i have a javascript menu, but the links in the menu need some of the variables i passed in my url to succesfully generate good url's...

For example....

say the url to the following website is
mysite.com/admin.php?adminid=blah

Code: Select all

<html>
<body>
Hi!
<SCRIPT language=JavaScript src="vertical_data.php" type=text/javascript></SCRIPT>
</body>
</html>
Now in that code snippet, some of php code in the vertical_data.php (which i might add for those of u that are confused; yes the PHP is embedded within the javascript) file needs to be able to use that adminid variable and after my attempts to echo $adminid within that vertical_data.php file I found out $adminid is not getting 'passed' (if you will). What do i need to do to allow that vertical_data.php file to grab that adminid variable?

Is this where i need to use sessions? If so any quick implementation examples?
Are there any questions you people have so i can better explain the problem? As you can tell i've had a hard time forming a question which also lowers the probability of googling this so... srry if its ez!

Thanks so much! :oops:

Posted: Sat Jul 12, 2003 11:49 pm
by m3mn0n
I say use cookies. At the top of each page adminid is used as a GET variable set a cookie with the contents of adminid. Then call the cookie contents within the PHP of the js file. Hope it works.


btw; have you tried:

Code: Select all

<html> 
<body> 
Hi! 
<?
$adminid = $_GET&#1111;'adminid'];
?>
<SCRIPT language=JavaScript src="vertical_data.php?adminid=blabla" type=text/javascript></SCRIPT> 
</body> 
</html>

Posted: Sun Jul 13, 2003 3:07 pm
by johnm1019
Thank u so much!
Gosh darn i knew it was just something simple....
It was 1 am and my brain was going in circles but thanks so much!
:D