Jump to content


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


*SOLVED* Functions Embeded into HREF?

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.

Share this post

Link to post
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.

Share this post

Link to post
Share on other sites


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.