Page 1 of 1

Can PHP determine if an <a href button was clicked?

Posted: Sun Feb 28, 2010 8:35 pm
by oldsportbiker
The following is the code that shows a user a small photo that when clicked displays the larger version of it. I'd like to provide
some custom php coding that is dependent on whether the user clicked on the photo. I realize that the javascript function returns a value of true or false but I'm not sure if I can somehow test and use that value in php.

Code: Select all


<a href="<?=getFullImageURL();?>" class="highslide" onclick="return hs.expand(this)" title="<?=getImageTitle();?>"><?php printImageThumb(getImageTitle());?></a>

Re: Can PHP determine if an <a href button was clicked?

Posted: Sun Feb 28, 2010 9:33 pm
by requinix
Once PHP has sent its stuff to the browser it has no idea about what goes on.

Try to code everything in JavaScript. If you can't, either
a) Refresh the page with the new information like with a typical link, or
b) Use AJAX to "fake" the new page without actually making the user visit the new page. You aren't restricted to displaying a whole HTML page - maybe just a couple bits of data that the JavaScript can use.