blufish Posted August 1, 2008 Share Posted August 1, 2008 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 https://forums.phpfreaks.com/topic/117654-solved-getting-stuff-out-of-textarea-and-populating-it-in-a-frame/ Share on other sites More sharing options...
Andy-H Posted August 1, 2008 Share Posted August 1, 2008 No idea but I saw your making an MMOrpg, add me. [email protected] lol Link to comment https://forums.phpfreaks.com/topic/117654-solved-getting-stuff-out-of-textarea-and-populating-it-in-a-frame/#findComment-605177 Share on other sites More sharing options...
Andy-H Posted August 1, 2008 Share Posted August 1, 2008 It would involve AJAX - that much I know... Link to comment https://forums.phpfreaks.com/topic/117654-solved-getting-stuff-out-of-textarea-and-populating-it-in-a-frame/#findComment-605179 Share on other sites More sharing options...
xenophobia Posted August 1, 2008 Share Posted August 1, 2008 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 https://forums.phpfreaks.com/topic/117654-solved-getting-stuff-out-of-textarea-and-populating-it-in-a-frame/#findComment-605370 Share on other sites More sharing options...
Andy-H Posted August 2, 2008 Share Posted August 2, 2008 For that to work you would have to post the form... Link to comment https://forums.phpfreaks.com/topic/117654-solved-getting-stuff-out-of-textarea-and-populating-it-in-a-frame/#findComment-605847 Share on other sites More sharing options...
Andy-H Posted August 2, 2008 Share Posted August 2, 2008 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 https://forums.phpfreaks.com/topic/117654-solved-getting-stuff-out-of-textarea-and-populating-it-in-a-frame/#findComment-605864 Share on other sites More sharing options...
Andy-H Posted August 2, 2008 Share Posted August 2, 2008 And you may want to do this with the output textbox... <textarea name="txtOut" cols="30" rows="5" style="overflow:hidden" readonly="true"></textarea> Link to comment https://forums.phpfreaks.com/topic/117654-solved-getting-stuff-out-of-textarea-and-populating-it-in-a-frame/#findComment-605870 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.