Hi all,
I want to get a textarea form and add each new line to a database as a seperate row. Does anyone know how to do this in PHP?
I really haven't a clue where to start
Thanks,
Mike
Hi all,
I want to get a textarea form and add each new line to a database as a seperate row. Does anyone know how to do this in PHP?
I really haven't a clue where to start
Thanks,
Mike
Don't you just love free internet games ?
You can do that with the explode() function.
Where $foo is the name of your textarea. $line would be an array, then you can handle the array however you want.PHP Code:
$line = explode ("\n", $foo);
That would echo out each line. Or you can do your insert from there.PHP Code:
foreach($line as $x) {
echo $x;
}
Last edited by mobilebadboy; 05-13-2004 at 03:37 PM.
Shawn Kerr .com
You would get ur textarea text by:
Then as mobeilebadboy suggested, but could do:PHP Code:
$textarea_text = $_POST['textarea_name'];
PHP Code:
foreach($line as $x) {
$sql="INSERT INTO table (text) VALUES ('$x')";
$outcome = mysql_query($sql);
}
I'll try it out later, thanks guys Thought it would be more complicated then that.
Don't you just love free internet games ?
Bookmarks