Ok.. im thinking its not possible but i searched the manual and no real luck

but heres my question is it possible in php to work out what was pressed on the keyboard..

ie i press K and then straight away K comes up.

Now is this possible

Oh yea.. I kinda dont want it to b a form.. thats what makes this look impossible

    I'd say this is impossible in PHP - after all, it's running on the server and doesn't know what's happening on the client. It can be done in Javascript (don't ask me how though, I used to know but I'm real foggy on the subject of Javascript programming at the moment).

      Ok thanx Weedpacket, also say from there.. can i print something from Javascript Into PHP...

        Yeah, have Javascript set a hidden field or so in a form and then have it submit the form.

          Hi planetsim,

          Try this for size (you may need to amend it a bit to work on Netscape but this works on Explorer 6:

          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

          <html lang="en">

          <head>

          <title></title>

          <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

          <meta name="keywords" content="">

          <meta name="description" content="">

          <SCRIPT TYPE="text/javascript">
          <!--
          function getKey(keyStroke) {
          var keyCode = (document.layers) ? keyStroke.which : event.keyCode;
          var keyString = String.fromCharCode(keyCode).toLowerCase();
          document.all.keypress.innerHTML = keyString;
          document.keypressform.keyhidden.value = keyString;
          }
          //-->
          </SCRIPT>

          </head>

          <body onKeyPress="getKey(event)">

          <div id="keypress"></div>
          <form action="somepage.php" name="keypressform">
          <input type="hidden" name="keyhidden">
          </form>

          </body>

          </html>

          HTH

          Mike

            that looks like what ive been seeing, in some tuts... ill try it.. looks like what i need.. I guess i better brush up on Javascript

              Write a Reply...