Results 1 to 5 of 5

Thread: Posting inputed content to textarea

  1. #1
    Join Date
    Feb 2008
    Location
    here
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Posting inputed content to textarea

    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 : )

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    So, like you want to type something inside of something, and while you're typing it shows up on the page updating?
    Jeremy | jfein.net

  3. #3
    Join Date
    Feb 2008
    Location
    here
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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".

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    would you like the page to reload? or would you just like a new box to appear with their name?

    for the latter
    Code:
    <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
    Code:
    <?php
    
    echo '<textarea name="full_name">My Name Is '. $_POST['full_name'] .'</textarea>';
    
    ?>
    which would produce something along the lines of

    Code:
     _________________________________
    | 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.
    Code:
    echo '<input type="text" name="full_name" value="'.$_POST['full_name'].'">';

  5. #5
    Join Date
    Feb 2008
    Location
    here
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thank you soooo much

    I knew it would be simpler than what I was trying =p

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •