View Full Version : php onclick?
Roost3r
09-25-2002, 01:47 PM
is there something i can use in php that works like the onclick javascript thing; after someone clicks a on a text link i need it to execute one of my functions in the same file
thanks
Nightfire
09-25-2002, 02:09 PM
PHP needs info processed to the server, so I doubt it will do that. If you don't want the screen refreshing, you'd have to use javascript
hey I think the php + javascript combination is ultra cool. actually you can do great stuff with it.
but for your purposes, the following script shud do just fine....
<?php
function myfunction(){
echo("<strong>I love PHP !</strong><br>");
}
?>
<a href="<?php echo("$PHP_SELF?execute=myfunction")?>">click to execute myfunction ! </a>
<p>
<?php
if ( isset($execute) ){
myfunction();
}
?>
uhh ohh but before using the script just make sure that in your php.ini file, register_globals is set as 'on'. or else all that this fancy querry string will get u will be an err :D
-----------------
www.siyahee.cjb.net (http://siyahee.cjb.net) needs a bigtime rennovation I think !
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.