Jump to content


Photo

*SOLVED* Functions Embeded into HREF?


  • Please log in to reply
2 replies to this topic

#1 dcyuri7

dcyuri7
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 10 April 2006 - 01:47 AM

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.

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 10 April 2006 - 10:18 AM

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.

#3 dcyuri7

dcyuri7
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 10 April 2006 - 09:24 PM

Thank you for your help!! whoo!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users