I would like to update multiple MySQL records from the same table, using only one submit button.
Here is a simple version of the code that I am using to generate the form:
<form action='' method='post'>
<?php
$sql = "SELECT TagName, TagID FROM tags";
$result = mysql_query($sql) or die ($sql. '-error' .mysql_error());
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<input type='text' name='TagField' value='".$row['TagName']."'>";
}
?>
<input type="submit" name="tag_edit_submit" value="Edit">
</form>
What sort of UPDATE query could I use? I can’t seem to figure out the correct combination of arrays/loops to make it happen. Please let me know if you require more information.
You can carry the tagIds with the tag names in the form. I assume tagIds count and tagNames count are identical.