Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Save to mysql and show text while typing onkeypress

    The idea is simple. A key you press (a letter) appears in updated page:

    keyj.php:

    Codice 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.

  2. #2
    Moderatore di PHP L'avatar di Alhazred
    Registrato dal
    Oct 2003
    Messaggi
    12,505
    Sorry xcislav, this is an Italian forum, not all the users can understand English and all of them must be able to read all the topics, so only Italian language is allowed.

Tag per questa discussione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.