timmah1 Posted October 12, 2008 Share Posted October 12, 2008 I have a page with 5 pics on it. A user has to pick 1 picture, and it turns into another picture. That works What I need is, once a user clicks on a picture, all the the other pictures should not be able to be clicked. I guess, disable all links after a click. How could I do this? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/128058-links/ Share on other sites More sharing options...
Lamez Posted October 12, 2008 Share Posted October 12, 2008 take a look at maybe ajax or javascript. Quote Link to comment https://forums.phpfreaks.com/topic/128058-links/#findComment-663114 Share on other sites More sharing options...
timmah1 Posted October 12, 2008 Author Share Posted October 12, 2008 javascript isn't good enough since it can be disabled, and then the links will work I need to figure out a concrete way to make everything no longer be a link after any link was clicked Quote Link to comment https://forums.phpfreaks.com/topic/128058-links/#findComment-663115 Share on other sites More sharing options...
DarkWater Posted October 12, 2008 Share Posted October 12, 2008 javascript isn't good enough since it can be disabled, and then the links will work I need to figure out a concrete way to make everything no longer be a link after any link was clicked Tell them to make sure Javascript is on. The <noscript> tag works wonders. Quote Link to comment https://forums.phpfreaks.com/topic/128058-links/#findComment-663116 Share on other sites More sharing options...
timmah1 Posted October 12, 2008 Author Share Posted October 12, 2008 ok, fair enough So how then do I disable the all links after a link as been clicked with javascript? Quote Link to comment https://forums.phpfreaks.com/topic/128058-links/#findComment-663117 Share on other sites More sharing options...
Lamez Posted October 12, 2008 Share Posted October 12, 2008 take a look at this really popular website: http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=disabling+links+with+javascript+after+clicked lol Quote Link to comment https://forums.phpfreaks.com/topic/128058-links/#findComment-663121 Share on other sites More sharing options...
timmah1 Posted October 12, 2008 Author Share Posted October 12, 2008 Nevermind. I got it But maybe you can help me out here. Once a user clicks on a picture, no other links work, which is good, but, they can just refresh the page and then click on another picture. Is there a way that if the user refreshes the page, the same picture stays? Quote Link to comment https://forums.phpfreaks.com/topic/128058-links/#findComment-663122 Share on other sites More sharing options...
Lamez Posted October 12, 2008 Share Posted October 12, 2008 take a look at session variables. You could use a session variable, combined with a if statement, and if the statement is true, then redirect them. http://php.about.com/od/advancedphp/ss/php_sessions_2.htm Quote Link to comment https://forums.phpfreaks.com/topic/128058-links/#findComment-663125 Share on other sites More sharing options...
micmania1 Posted October 12, 2008 Share Posted October 12, 2008 if (isset($_GET['img'])) { $img = array('img0.gif' => 0, 'img1.gif' => 0); if (array_key_exists($_GET['img'], $img)) { $img[$_GET['img']] = 1; } } else { // Clickable $img = array('img0.gif' => 1, 'img1.gif' => 1); } foreach ($img as $k => $v) { if ($v == 0) { echo '<a href="#"><img src="'.$k.'" /></a>'; } else { echo '<a href="?img='.$k.'"><img src="'.$k.'" /></a>'; } } ?> Not Tested. Quote Link to comment https://forums.phpfreaks.com/topic/128058-links/#findComment-663256 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.