Page 1 of 1
assigning value
Posted: Fri Sep 15, 2006 10:22 pm
by speedy33417
Quick question.
How do you assign value to a variable based on which link the user clicks.
Say I have three links that point to one.php, two.php, three.php
When the user clicks on any of those links I want assign the number of that page to a variable before going to that page.
Thanks.
Posted: Fri Sep 15, 2006 11:00 pm
by feyd
Assign it to a variable where? PHP won't be run until the page is requested.
Posted: Sat Sep 16, 2006 12:34 am
by aaronhall
Maybe we could offer some suggestions if you told us what you're trying to accomplish
Posted: Sat Sep 16, 2006 1:40 am
by gkwhitworth
yeah that is kinda finicky....feyd is right. Give a little more detail of why they are clicking these links (view database info, log into an area, view a gallery) so we can have some kind of idea why you want to assign values to the links.
--
Greg
Posted: Sat Sep 16, 2006 6:21 am
by speedy33417
One of the pages where I would use it is a photo gallery page. Clicking on a thumbpic would save the album_id in a variable then process the page based on that variable.
album_view.php checks if there's a value assigned to the variable. If not that means it will display the main gallery, if there's a value assigned to it then it will display that sub-gallery.
Posted: Sat Sep 16, 2006 7:49 am
by feyd
I am not sure what you need codewise to accomplish that as I don't quite understand how you intend for it to work. Generally the variable would be set by the receiving script.
Posted: Sat Sep 16, 2006 8:06 am
by speedy33417
Well, that's exactly what my problem was. I already had to have the variable assigned to some value by the time I get to the receiving page.
I'll probably just use this code.
Code: Select all
<a href=\"album_view.php?page=$album\">