Making function calls on page events

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
User avatar
d3ez
Forum Newbie
Posts: 6
Joined: Tue Oct 15, 2002 11:56 am
Location: VA

Making function calls on page events

Post 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
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Yep

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Always a good idea to read forum stickies:
viewtopic.php?t=1030

Mac
User avatar
d3ez
Forum Newbie
Posts: 6
Joined: Tue Oct 15, 2002 11:56 am
Location: VA

Post 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

in the php-cvs there is a experimental package called 'ActiveScript'.
http://www.zend.com/lists/php-dev/200205/msg00662.html
Post Reply