ok I have some buttons that I would like to store php variables and then insert them into the page that the link redirects them to...
Here's the scenario...
I have a button that I would like to store a variable called "weddings"
the link will hold the variable and redirect the browser to a page called gallery.php
once at the gallery.php page it will convert the vaiable "weddings" into
"thumbnails.php?album=3" . Then I have a place where I am using an iframe that will put that "thumbnail...." variable into it and then load the iframe accordingly.
Basically I need to know how to pass a vaiable via URL and then retrieve it on the new page and use it.
Notice that the variable ultimatly needs to be "thumbnails.php?album=3" but since it has the "?" in it I don't think that I can pass that via the URL...can I?
For those interested heres what I am using it for...
I have a template page that has differn't links on it... One one side of the page I have a menu and on the other side I have a "content" box that I change for each page. I am using a photo program called coppermine and am uning "iframes" to import that photo program into the "content" box on my templates. I would like to have some of the links on my template load the photo program to specific galleries...So I need to pass a variable through the url and then have the iframe use that variable as part of the URL that it load.
Anyone that can help would be a lifesaver and I would own you greatly.
Thanks
Jason
Passing vaiable via URL and retrieving them???
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
I don't understand what you mean by the fact you can't use the '?'
To pass GET variables you do yourfile.php?varname=varvalue
Pick up the variable at the page that is recieving it using $_GET['varname']
Your question doesn't make any sense to me...
If you need to pass a VALUE in the url that has specialcharacters in it such as '?' then use urlencode() on the value before sending it and then urldecode($_GET['varname']) when you pick it up.
I hope I answered whatever the question was
To pass GET variables you do yourfile.php?varname=varvalue
Pick up the variable at the page that is recieving it using $_GET['varname']
Your question doesn't make any sense to me...
If you need to pass a VALUE in the url that has specialcharacters in it such as '?' then use urlencode() on the value before sending it and then urldecode($_GET['varname']) when you pick it up.
I hope I answered whatever the question was
Ya that almost answers my question...Basically I guess I needed to know how to pass variables with special characters...
so say I would like to pass the following variable...
gallery/thumbnails.php?album=3
how do I encode that...can I encode it right as I send it through the url or do I have to encode it before hand...
give me an example if
varname = "page"
varvalue = "gallery/thumbnails.php?album=3"
Thanks
Jason
so say I would like to pass the following variable...
gallery/thumbnails.php?album=3
how do I encode that...can I encode it right as I send it through the url or do I have to encode it before hand...
give me an example if
varname = "page"
varvalue = "gallery/thumbnails.php?album=3"
Thanks
Jason
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
$myvar = 'gallery/thumbnails.php?album=3';
$myvar = rawurlencode($myvar);
$var = 'page';
$var = rawurlencode($var);
echo 'http' . '://yoursite.com/somepage.php?' . $var . '=' . $myvar;