speedy33417 Posted September 16, 2006 Share Posted September 16, 2006 Quick question. How do you assign value to a variable based on which link the user clicks. 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.Thanks. Link to comment https://forums.phpfreaks.com/topic/20966-value-assigning/ Share on other sites More sharing options...
ronverdonk Posted September 16, 2006 Share Posted September 16, 2006 JavaScript can do that with the onClick() function Link to comment https://forums.phpfreaks.com/topic/20966-value-assigning/#findComment-92973 Share on other sites More sharing options...
448191 Posted September 16, 2006 Share Posted September 16, 2006 [quote author=speedy33417 link=topic=108282.msg435456#msg435456 date=1158407669]Quick question. How do you assign value to a variable based on which link the user clicks. 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.Thanks.[/quote]You can't use onclick to set php variables, unless you have an ajax implementation.The most obvious solution is [url=http://www.plus2net.com/php_tutorial/variables2.php]passing variables though 'get'[/url]. Link to comment https://forums.phpfreaks.com/topic/20966-value-assigning/#findComment-93021 Share on other sites More sharing options...
ronverdonk Posted September 16, 2006 Share Posted September 16, 2006 Sorry, that was stupid of me. I (almost automatically) think in Ajax terms. Link to comment https://forums.phpfreaks.com/topic/20966-value-assigning/#findComment-93053 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.