Jump to content

Recommended Posts

Here's my problem:
I need to go from href links, to php handled functions.
There has to be a way to do this.
Of course I can use ?<var>=<data> in the url, but what if I just want to execute a function when the user clicks on an href?

Ill be more specific to my problem... I am using switch statements to handle which page to include, by storing the next location to goto using SESSION variables. I want the user to be able to click on a link(HTML HREF) and for it to set the SESSION variable to the next location accordingly.
Any help is greatly appreciated.
Link to comment
https://forums.phpfreaks.com/topic/6988-solved-functions-embeded-into-href/
Share on other sites

PHP is processed by the server and so a request must be made to the server for the PHP to be processed. You cannot run a PHP function as soon as you click a link, like you can do with Javascript. However you can do this with the aid of AJAX.

Head over to AJAXFreaks.com for more info on AJAX or by going through the [a href=\"http://www.ajaxfreaks.com/tutorials/1/0.php\" target=\"_blank\"]AJAX Introduction tutorial[/a].

That is the only way to do what you want to do.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.