Hello all,
I have the following form, which displays a maximum (sql LIMIT) of 5 values/$rows.
I need to be able to replace or add to the current db contents
The code uses a while loop to populate the form:
while($row = mysql_fetch_assoc($result)) {
<input type="hidden" name ="filename[]" id="filename" value=<?php echo $row['filename']; ?> />
<p><label for="keywords">Keywords:</label><br/>
<textarea name="keywords[]" id="keywords" cols="30" rows="5"> <?php echo $row['keywords']; ?></textarea>
</p>
}//end while()
<input type="submit" name="go" id="go" value="Update"/>
Of course, there's more to the form, but you get the gist. For the life of me, I can't figure out how to update the records (up to five at a time) using if(array_key_exists('go',$_POST)) { since the form values are the same, only incremented by the number value (keywords[], price[], etc.)
When using sql to fill the original contents needing to be updated, how would I go about creating the correct values for the following UPDATE statement when there are multiple entries with the same name (ie:keywords[], etc.):
$updated = "UPDATE table_x SET keywords=$keywords WHERE gallery_name = '$cool_name' && filename = '$filename'";
THANKS!