jd2007 Posted December 16, 2007 Share Posted December 16, 2007 for example, when i click the button below : <input type="button" value="Click" /> i want this function to be called, (like JavaScript): <?php function click() { echo "abc"; } Quote Link to comment Share on other sites More sharing options...
haku Posted December 16, 2007 Share Posted December 16, 2007 You can try this: <form> //include necessary elements in form tag <input type="button" name="execute_function" value="Click" /> </form> And then on whatever page you are executing the code on, include this: <?php if(isset($_POST['execute_function'])) { click(); } ?> However, depending on what you are trying to do, a javascript function may serve you better. What is it that you want to do? Quote Link to comment Share on other sites More sharing options...
xervia Posted December 16, 2007 Share Posted December 16, 2007 thanks for the reply, although it wasn't my question. i was wondering if i could push this a little further? how does one get a function to run a after a specific time frame has expired for example a slide show that reloads a new picture after 6 seconds? Quote Link to comment Share on other sites More sharing options...
haku Posted December 16, 2007 Share Posted December 16, 2007 It cant be done without javascript. PHP runs entirely on the server, whereas a slideshow etc runs on the client. The server can't know what is happening on the client without either the user either clicking a link or pushing a button in order to send data to the server, or javascript executing some event that sends data to the server. Although I wonder if you maybe posted in the wrong thread? You arent the OP of this thread. Quote Link to comment Share on other sites More sharing options...
jd2007 Posted December 16, 2007 Author Share Posted December 16, 2007 read about javascript's setTimeout function here http://www.w3schools.com/htmldom/met_win_settimeout.asp 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.