Le0 Posted July 27, 2007 Share Posted July 27, 2007 he there i'm new to PHP and i've got a question, probably someone of you can solve it easiely.... i've got a function and i want that this function got "runned" if some hit a button: my code for define the function (echo "hello world" is just a dummy for a much more complicated command): <?php function test() { echo "hello world";} ?> and the button: <input type="button" value="GO" onClick="test()"> mfsg AX Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted July 27, 2007 Share Posted July 27, 2007 php is finished before the client sees the page - one on the client on js is available. Your options are - send a new request loading the page once more but with some data sent (like a form) to use in flow control and call functions you need etc. OR send an ajax request which could run some php code and return some html that your ajax request can place in a specified element... Quote Link to comment Share on other sites More sharing options...
hvle Posted July 27, 2007 Share Posted July 27, 2007 can't be done with PHP, you may confuse this with java script: something like this would work <script type="text/javascript" language="javascript"> function test() { alert("hello world!");} </script> and for the button: <input type="button" value="GO" onClick="test();"> Quote Link to comment Share on other sites More sharing options...
Le0 Posted July 27, 2007 Author Share Posted July 27, 2007 ok, i'm no good in using java scripts but i'll try thx 4 the help! mfsg AX Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.