lynxus Posted October 25, 2010 Share Posted October 25, 2010 Hi Guys, I have a textarea on a html page with XXX amount of lines. How can I in php insert a separate mysqlrow for EACH line on the html textarea? Thanks G Quote Link to comment Share on other sites More sharing options...
vichu.1985 Posted October 25, 2010 Share Posted October 25, 2010 Dude, I assume that every line is separated by "Enter key"(At the end of line you have pressed enter key) in the Textarea. In this case you can use the following code and get the textarea value in array format and write insert query to it...... $values = $_POST['textarea_name']; $array = split("\r\n", $values); foreach($array as $line){ mysql_query("insert into table(field) values($line)"); } Quote Link to comment Share on other sites More sharing options...
lynxus Posted October 25, 2010 Author Share Posted October 25, 2010 Sweet, Thanks man. Been googling like mad and cant find anything that works correctly. This did it fine. Thanks very muchly! -G Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.