I have the following code which is meant to cycle through names submitted on a form:
$row_count = count($_POST['name']);
if ($row_count > 0) {
mysql_select_db($database, $connection);
$name = array();
$workshop = array();
for($i = 0; $i < $row_count; $i++) {
// variable sanitation...
$name[i] = mysql_real_escape_string(ucwords($_POST['name'][$i]));
$workshop[i] = mysql_real_escape_string($_POST['workshop'][$i]);
}
$names = "('".implode("','",$name)."')";
.....etc
For some reason $names is only returning the last name submitted on the form, rather than all of the names. Could someone help me get this working correctly?
Thanks,
Nick
problem is here
solution:
now your code is working in this way:
so you have only one element in
$name,$workshoparrays. (last from loop)