juniper747 wrote:except only the LAST value of 'temp_name' gets stored into the multiple rows of the different 'potential' values in the database.
Of course, since that's what you're telling it to do:
foreach($temp_names as $temp_name) {
$sql = mysql_query(" UPDATE potentials SET temp_name='$temp_name' WHERE candidate='$potential' ") or die (mysql_error());
}
Update all of the records in the potentials table to have a temp_name of $temp_name which have a candidate with the current value of $potential. For every $temp_name.
Then do it all over again with the next value of $potential.
What you need to do is build an array that pairs each $temp_name with its corresponding $potential in a single array, and then loop over that.
$potentials_and_names = array_combine($_SESSION['potentials_array'], $_POST['input_names']);
foreach($potentials_and_names as $potential=>$temp_name)
{
//....
}