...

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



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

Example:


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

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum