Hi all,
After trying to get this to work for what seams like hours I am now asking for help.
I am trying to write a script that will update multiple records using one submit.
This is what I have so far;
<form id="form2" name="form2" method="post" action="insert_image_order.php" target="_self">
<select name="ImageOrder" class="sys_bodytext_left" id="ImageOrder">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<input type="submit" name="button2" id="button2" value="Submit" /></td>
<input type="hidden" name="MM_update" value="form2" />
<input type="hidden" name="RecordID" value="<?php echo $row_ImageLookUp['RecordID']; ?>" />
</form>
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form2")) {
foreach ($_POST['RecordID'] as $RecordID) {
$updateSQL = sprintf("UPDATE Images SET ImageOrder=%s WHERE RecordID=%s",
GetSQLValueString($_POST['ImageOrder']= $_POST['ImageOrder'][$ImageOrder], "int"),
GetSQLValueString($_POST['RecordID'] = $RecordID, "int"));
mysql_select_db($database_Swift, $Swift);
$Result1 = mysql_query($updateSQL, $Swift) or die(mysql_error());
}
}
Prior to the data been submitted it is validated and sanitized.
I have tested to see how many record are in the $_POST array so that part is what I expect to see.
Can anyone see where I am going wrong.
Many thanks in advance.