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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
oldsportbiker
Forum Newbie
Posts: 7
Joined: Wed Feb 24, 2010 10:21 pm

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

Post 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>
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

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

Post 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.
Post Reply