Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2008
    Posts
    57
    Thanks
    15
    Thanked 1 Time in 1 Post

    Question [?] form value per textarea line

    How would I go about submitting each new line in a textarea as a value?

    Example:
    Code:
    <form method="post" action="foo.php">
    <textarea name="foo" rows="10" cols="10">
    value 1
    value 2
    value 3
    </textarea>
    <input type="submit" value="submit" />
    </form>
    would return as something like this:

    Lorem ipsum dolor sit amet, value 1 consectetuer adipiscing elit. value 2 commodo ligula eget dolor. Aenean massa.
    Cum sociis natoque penatibus et magnis dis parturient montes, nascetur value 3.
    I know using <inputs> with an array[] would work but its not really viable for what I'm trying to write.

    As always thanks in advance
    Newbie at most things ...Hey we all gotta start somewhere right :)

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    explode("/n", $_REQUEST['foo']);

  • Users who have thanked angst for this post:

    buggy (03-08-2010)

  • #3
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Quote Originally Posted by angst View Post
    explode("/n", $_REQUEST['foo']);
    buggy, it's best to use $_GET or $_POST instead of $_REQUEST, if possible. Leave as many holes plugged as possible.

  • Users who have thanked JohnDubya for this post:

    buggy (03-08-2010)


  •  

    Posting Permissions

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