updating a form with multiple fields prob!
Posted: Mon Aug 27, 2007 12:33 pm
I wonder if somebody can help me with this form.
I want to be able to update my database table by using a sort order where I can arrange the order of a list by using numbers. I have no problem in querying the database and retuning the values using the following script.
The problem is that I can’t get the form to process the changes that are made and I know that my problem is to do with trying to have one ‘Submit’ button. I can get this to work using a simple form using the following where one form field is being updated.
However once I try to introduce multiple fields to update then the forms fails. So can anyone tell/show me how I can set up a form so that it accepts multiple changes and have one submit button to do the updating
This is a print out of the first code above incase it’s of any value.
Thanks a mil
I want to be able to update my database table by using a sort order where I can arrange the order of a list by using numbers. I have no problem in querying the database and retuning the values using the following script.
Code: Select all
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td>Solo Title:</td>
<td>Sort:</td>
</tr>
<?php do { ?>
<tr valign="baseline">
<td><?php echo $row_GetSolo_Inst['Solo_Title']; ?></td>
<td><input type="text" name="sort" value="<?php echo $row_GetSolo_Inst['sort']; ?>" size="10"></td>
</tr>
<input type="hidden" name="solo_ID" value="<?php echo $row_GetSolo_Inst['solo_ID']; ?>">
<?php } while ($row_GetSolo_Inst = mysql_fetch_assoc($GetSolo_Inst)); ?>
<tr valign="baseline">
<td><input type="submit" value="Update record"></td>
<td> </td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
</form>Code: Select all
$updateSQL = sprintf("UPDATE compositions_solo SET sort=%s WHERE solo_ID=%s",
GetSQLValueString($_POST['sort'], "int"),
GetSQLValueString($_POST['solo_ID'], "int"));
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td>Solo Title:</td>
<td>Sort:</td>
</tr>
<tr valign="baseline">
<td><?php echo $row_GetSolo_Inst['Solo_Title']; ?></td>
<td><input type="text" name="sort" value="<?php echo $row_GetSolo_Inst['sort']; ?>" size="10"></td>
</tr>
<input type="hidden" name="solo_ID" value="<?php echo $row_GetSolo_Inst['solo_ID']; ?>">
<tr valign="baseline">
<td><input type="submit" value="Update record"></td>
<td> </td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
</form>This is a print out of the first code above incase it’s of any value.
Thanks a mil
Code: Select all
<form method="post" name="form1" action=”self.php">
Voces Críticas (2004) <input type="text" name="sort" value="6" size="10">
<input type="hidden" name="solo_ID" value="7
Canción y Tango (2004) <input type="text" name="sort" value="6" size="10">
<input type="hidden" name="solo_ID" value="8">
Twelve Études (2004) <input type="text" name="sort" value="8" size="10">
<input type="hidden" name="solo_ID" value="9">
<input type="submit" value="Update record">
<input type="hidden" name="MM_update" value="form1">
</form>