I am new to Php and what I would like to do is input multiple lines of data into a database through a Php form textfield. The code I have used now is.
for($n=0;$n<5;$n++) {
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO cmsd1 (Population_Name) VALUES (%s)",
GetSQLValueString($_POST['Form1'], "text"));
mysql_select_db($database_cmsdtest, $cmsdtest);
$Result1 = mysql_query($insertSQL, $cmsdtest) or die(mysql_error());
$insertGoTo = "ttt.php";
}
}
However as you can see, all it does is loop the data I have given 5 times. I got a suggestion to use 'implode' function but as I am new, I have no clue on how to do it. I use Dreamweaver for help with my PhP. I would ideally like this code to loop as many times as the data entered is and not just 5.. Each data point is separated by a space. It could be 100 too. Please advice.
Tried imploding this way but doesn't work..
GetSQLValueString(implode(" ",$_POST['form1']), "text"));