Jump to content

Links


timmah1

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/128058-links/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/128058-links/#findComment-663116
Share on other sites

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?

 

Link to comment
https://forums.phpfreaks.com/topic/128058-links/#findComment-663122
Share on other sites

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.

 

 

Link to comment
https://forums.phpfreaks.com/topic/128058-links/#findComment-663256
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.