Jump to content

[SOLVED] Just curious if this is possible with PHP...


galvin

Recommended Posts

Is it possible (using PHP) to have a form where a user enter's text into a text field and have that text appears somewhere else on the page INSTANTLY, AS THE USER IS TYPING IT.

 

So if the user types "I like monkeys", as soon as they type "I" in the text field, the letter "I" will appear somewhere else on the page before they even type the word "like".

 

My hope is to allow users to type some text and I will have the text show up somewhere else instantly, formatted much nicer (using CSS).

 

I've seen this type of thing on sites like "blogger.com" so I know it's possible, just not sure if PHP can do it.

 

And I'm not asking anyone to write any code, I just need to be pointed in the right direction (if it is in fact possible to do this type of thing with PHP).

 

Thanks!

 

 

 

Link to comment
Share on other sites

<html>
<head>
  <script type="text/javascript">
  function updateText(inputObj, outputID)
  {
    document.getElementById(outputID).innerHTML = inputObj.value;
  }
  </script>
</head>
<body>
Type your input here:
<input type="text" id="text" name="text" onkeyup="updateText(this, 'spanID');" />
<br /><br />
The text you are typing is: <span id="spanID"><span>
</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.