Page 1 of 1

Making function calls on page events

Posted: Tue Oct 15, 2002 12:07 pm
by d3ez
Is there any way to call a php function from an onClick event or just from a link on the page?

Maybe something like....

Code: Select all

<a href=<? callToFunction (); ?> >Click Here to Call the func </a>
That is not calling to another page causing pauses in screen display, but just a call to a function that will do something and not leave the current page

Yep

Posted: Tue Oct 15, 2002 12:30 pm
by AVATAr
First of all, php is server side, so you have to reload the page so you can exec the function.

You can call a function in the same page, like this:

<a href="mypage.php?call=function"> call the func </a>

"mypage.php" could be the actual page or not.

in mypage you can see if the variable call is set with:

isset($call)

en then call the function you want depending on de value of $call (in this example $call = function)

//See Sticky in this forum before using passing variables in the url

hope it helps

Posted: Wed Oct 16, 2002 1:59 am
by twigletmac
Always a good idea to read forum stickies:
viewtopic.php?t=1030

Mac

Posted: Wed Oct 16, 2002 10:21 am
by d3ez
Do you think there will be anyway that PHP will move up to that level of being semi client/server side? (like aspx? or cf?). I don't like those prods. but I do think they have a good idea going.

Posted: Wed Oct 16, 2002 10:48 am
by volka
in the php-cvs there is a experimental package called 'ActiveScript'.
http://www.zend.com/lists/php-dev/200205/msg00662.html