rm_phpfreaks Posted April 5, 2009 Share Posted April 5, 2009 <?php function myfunction(){ echo "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG!"; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script language="javascript" type="text/javascript"> function ILovePHP() { window.document.write('<?=myfunction();?>'); } </script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <form action="" method="post"><input name="" type="text" onChange="ILovePHP();"></form><p> </body> </html> Run ECHO COMMAND when you type some text on textbox. Link to comment https://forums.phpfreaks.com/topic/152614-calling-php-function-in-javascript-events-eg-onchange/ Share on other sites More sharing options...
gffg4574fghsDSGDGKJYM Posted April 5, 2009 Share Posted April 5, 2009 You can't run a server-side script PHP function with a client side javascript. AJAX http://www.google.com/search?q=ajax is probably what you are looking for.... Link to comment https://forums.phpfreaks.com/topic/152614-calling-php-function-in-javascript-events-eg-onchange/#findComment-801525 Share on other sites More sharing options...
jjacquay712 Posted April 5, 2009 Share Posted April 5, 2009 I would use ajax to do that, but does it really need to be php? you could probably just use a javascript function to do that same. Link to comment https://forums.phpfreaks.com/topic/152614-calling-php-function-in-javascript-events-eg-onchange/#findComment-801529 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.