Page 1 of 1

start a function without pressing button after PHP

Posted: Mon Mar 08, 2010 2:00 pm
by Goofan
Hi I wonder if there is some kind of way to start a function after a button have been pressed and the php has done some stuffs then it would
automatically start up? Not when you press a button but on "normal" command... I guess its a basic question but I need the help for it so. =)



Code exampel:

Code: Select all

 
if(isset($_POST['dogs']))
{
  If ($money > $Spend){
-->   run javascript function  <--
  }
 
}
 

Re: start a function without pressing button after PHP

Posted: Mon Mar 08, 2010 2:07 pm
by AbraCadaver
You'll have to be more specific, but it appears as easy as this:

Code: Select all

if(isset($_POST['dogs']))
{
 if($money > $Spend){
     echo '
      <script type="text/javascript">
      yourJSfunc();
      </script>';
  }
}

Re: start a function without pressing button after PHP

Posted: Mon Mar 08, 2010 2:16 pm
by Goofan
yea well that was what i meant. thats why i had the exampel code... but is it really as easy as calling the function likely that? no special commands or so? "thought js would make that bit harder"