View Full Version : [?] form value per textarea line

03-01-2010, 01:04 PM
How would I go about submitting each new line in a textarea as a value?


<form method="post" action="foo.php">
<textarea name="foo" rows="10" cols="10">
value 1
value 2
value 3
<input type="submit" value="submit" />

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

03-01-2010, 02:45 PM
explode("/n", $_REQUEST['foo']);

03-01-2010, 04:19 PM
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. :)