I have a simple form which is a textarea and I need to insert each lines in my textarea into a different rows in MySQL.
HTML code:
Try this:
$text = trim($_POST['textareaname']); $textAr = explode("\n", $text); $textAr = array_filter($textAr, 'trim'); // remove any extra \r chars foreach ($textAr as $line) { // Your sql Query here with $line as the string. }