SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    ireland
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <textarea> Whats up !!!!!!

    Below is the code for my comments field, I have 5 fields in total using the same code but when the submit button is pressed and if one of the fields is not filled in the text in the comment field disappears.

    Do textarea boxes not hold onto the inputted information?????



    <tr>
    <td class = "graham"><span class = "bold">* Comment/span></td>
    <td class = "graham"><textarea class="three" rows="10" name = "comment" cols="50" value="<?php if(isset($_POST['comment'])) echo stripslashes($_POST['comment']);?>"></textarea>
    </td>
    </tr>


    Thank you in advance

  2. #2
    SitePoint Evangelist
    Join Date
    May 2006
    Location
    Austin
    Posts
    401
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Textareas dont have a value attribute.

    Use this instead:

    <textarea class="three" rows="10" name = "comment" cols="50"><?php if(isset($_POST['comment'])) echo stripslashes($_POST['comment']);?></textarea>

    Quote Originally Posted by gokeeffe View Post
    Below is the code for my comments field, I have 5 fields in total using the same code but when the submit button is pressed and if one of the fields is not filled in the text in the comment field disappears.

    Do textarea boxes not hold onto the inputted information?????



    <tr>
    <td class = "graham"><span class = "bold">* Comment/span></td>
    <td class = "graham"><textarea class="three" rows="10" name = "comment" cols="50" value="<?php if(isset($_POST['comment'])) echo stripslashes($_POST['comment']);?>"></textarea>
    </td>
    </tr>
    Merchant Equipment Store - Merchant Services, POS, Equipment, and supplies.
    Merchant Account Blog | Ecommerce Blog

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Ohio
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think your problem is more one with HTML then PHP. the textarea tag does not have a value attribute like its input and other counterparts. Instead you must place the value of the text area between the opening and closing text area tags.

    So you code should look something like this:

    HTML Code:
    <tr>
    <td class = "graham"><span class = "bold">* Comment/span></td>
    <td class = "graham"><textarea class="three" rows="10" name = "comment" cols="50">
    <?php if(isset($_POST['comment'])) echo stripslashes($_POST['comment']);?>
    </textarea>
    </td>
    </tr>

  4. #4
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    ireland
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks alot fella's problem solved

    Nice one!


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
  •