Jump to content

[SOLVED] Getting stuff out of textarea and populating it in a frame


blufish

Recommended Posts

Heres my question, If I have a textarea, on one half of my page and on the other half I have a frame which contains whatever is written inside the textarea, how do I get it so that as soon as you change the textarea the frame changes it's contents to match the textarea.

 

Thanks, Blufish

Link to comment
Share on other sites

So you got 2 frames right? Let's call frame1 => a.html and frame2 => b.php

 

So let's say your textarea is in frame1 and your display will be in frame2.

 

So in fram1, you put a form like this:

<form name="postTextToFrame2" action="b.php" method="post" target="frame2">
<textarea name="myText" cols="50" rows="5"></textarea>
<input type="submit" value="Post!" />
</form>

 

So the data will be posted to the target frame. Then in frame2 (the "b.php"), you will just do something like this:

<?php
if(isset($_POST['myText'])) {
    // Print out your text!!!
    echo $_POST['myText'];
}

?>

Link to comment
Share on other sites

Figured it out for you mate.

 

<html>
<head>
<script type="text/javascript">
<!--

function addText(){

window.document.myForm.txtOut.value=window.document.myForm.txtIn.value;

}
//-->
</script>
</head>
<body>
<form method="post" name="myForm">
<center>
Enter text in this box:<br /><br />
<textarea name="txtIn" cols="30" rows="5" onKeyUp="addText()"></textarea>
<br /><br /><br />
And it will appear in this one:<br /><br />
<textarea name="txtOut" cols="30" rows="5"></textarea>
</form>
</body>
</html>

 

Definately works, I already tested it... :)

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.