View Full Version : Posting inputed content to textarea
SevenBeasts13
02-25-2008, 08:56 AM
Prolly a simple question/answer but I'm a n00b, and I would appreciate any info sooo much.
Anyways, suppose I have a form where a user types something, how would I transfer that to a textarea already on the page?
I've tried using several variations of $_POST but it didn't quite work once I added more options.
If I need to be more specific just let me know : )
So, like you want to type something inside of something, and while you're typing it shows up on the page updating?
SevenBeasts13
02-25-2008, 08:49 PM
Similar to that.
The user types their info, and when they click submit a textarea with text based on that is displayed.
For example, they type in "John", click submit, and a textarea displays with "My name is John".
boogyman
02-25-2008, 09:10 PM
would you like the page to reload? or would you just like a new box to appear with their name?
for the latter
<form method="post" action="write.php">
<p>
<label>Full Name:</label>
<textarea name="full_name"></textarea>
</p>
<input type="submit" value="Submit Name">
</form>
write.php
<?php
echo '<textarea name="full_name">My Name Is '. $_POST['full_name'] .'</textarea>';
?>
which would produce something along the lines of
_________________________________
| My Name Is __FULL_NAME__ |
| |
| |
|________________________________|
please excuse the ASCII art as I didnt think it prudent to actually create a page and take a screen shot.
now on another note.... if they are entering their name you shouldn't be using a textarea, but rather an input type.
echo '<input type="text" name="full_name" value="'.$_POST['full_name'].'">';
SevenBeasts13
02-25-2008, 09:38 PM
Thank you soooo much http://www.dynamicdrive.com/forums/images/icons/icon14.gif
I knew it would be simpler than what I was trying =p
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.