dprichard
07-16-2007, 04:35 PM
I am trying to update multiple rows with one submit button.
I currently have a table that repeats out the following form for each folder in the database:
<form name="form1" method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<label>
<div align="center">
<input name="updateorder" type="hidden" id="updateorder" value="updateorder">
<input type="hidden" name="dcid" id="dcid" value="<?php echo $row_categories['dcid']; ?>">
<input type="hidden" name="dcparent" id="dcparent" value="<?php echo $row_categories['dcparent']; ?>">
<input name="dcorder" type="text" id="dcorder" size="3" maxlength="3" value="<?php echo $row_categories['dcorder']; ?>">
<input name="submit2" type="image" src="/images/refresh.png" alt="Refresh Item" align="middle" width="16" height="16">
</div>
</label>
<div align="center"></div>
</form>
Then I use this update statement to update the database.
if(isset($_POST['updateorder'])) {
$dcorder = mysql_real_escape_string($_POST['dcorder']);
$dcid = mysql_real_escape_string($_POST['dcid']);
$updateorder = mysql_query("UPDATE documentcategories SET dcorder='$dcorder' WHERE dcid='$dcid'") or die(mysql_error());
}
I would like to be able to encompass the entire table and update them with one button when submitted instead of having to update one box, then submit and the next box then submit.
Any help would be greatly appreciated!!!
I currently have a table that repeats out the following form for each folder in the database:
<form name="form1" method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<label>
<div align="center">
<input name="updateorder" type="hidden" id="updateorder" value="updateorder">
<input type="hidden" name="dcid" id="dcid" value="<?php echo $row_categories['dcid']; ?>">
<input type="hidden" name="dcparent" id="dcparent" value="<?php echo $row_categories['dcparent']; ?>">
<input name="dcorder" type="text" id="dcorder" size="3" maxlength="3" value="<?php echo $row_categories['dcorder']; ?>">
<input name="submit2" type="image" src="/images/refresh.png" alt="Refresh Item" align="middle" width="16" height="16">
</div>
</label>
<div align="center"></div>
</form>
Then I use this update statement to update the database.
if(isset($_POST['updateorder'])) {
$dcorder = mysql_real_escape_string($_POST['dcorder']);
$dcid = mysql_real_escape_string($_POST['dcid']);
$updateorder = mysql_query("UPDATE documentcategories SET dcorder='$dcorder' WHERE dcid='$dcid'") or die(mysql_error());
}
I would like to be able to encompass the entire table and update them with one button when submitted instead of having to update one box, then submit and the next box then submit.
Any help would be greatly appreciated!!!