xcislav Posted April 14, 2014 Share Posted April 14, 2014 The idea is simple. A key you press (a letter) appears in updated page:keyj.php: <input id='k'></input> <script type="text/javascript"> document.getElementById('k').onkeypress=function() { <?php $db=new PDO('mysql:host=localhost;dbname=test;charset=utf8','$us','$ps'); $db->exec("UPDATE TXT SET texts=k.value"); $rl=$db->query("SELECT texts FROM TXT"); print_r($rl->fetchColumn()); ?> } </script> The intention is to have text on the screen via print_r. I successfully used it in another php to exchange information with MySQL and users screen (worked).Here - the more you type and the more k.value is the more text will be on screen (just from server).Unfortunately something went wrong. Quote Link to comment Share on other sites More sharing options...
Solution trq Posted April 14, 2014 Solution Share Posted April 14, 2014 PHP executes on the server, long before any javascript is sent to the client to be executed. Quote Link to comment Share on other sites More sharing options...
xcislav Posted April 15, 2014 Author Share Posted April 15, 2014 PHP executes on the server, long before any javascript is sent to the client to be executed. I'm very sorry, I hoped... it's ok. 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.