I have a form with a checkbox and a submit button. I populate the name of the checkbox with as many items I have in my table. My frustration is finding out how to insert into the table: xlink the data from the form below.
See code below for Form.php
<form name="form1" method="POST" action="update.php">
<tr>
<td class='nicetableheader'>ID</td>
<td class='nicetableheader'>Product Name</td>
<td class='nicetableheader'>Cross Link</td>
</tr>
<?
$sql = mysql_query("SELECT * FROM servers ORDER BY server_name ASC"); // Perform MySQL query on only the current page number's results
while ($row = mysql_fetch_array($sql)) { ?>
<tr>
<td class='nicetablerow'><? echo $row['productID']; ?></td>
<td class='nicetablerow'><?php echo $row['server_name']; ?></td>
<td class='nicetablerow'><input type="checkbox" name="xlink" value="<? echo $row['productID']; ?>"></td>
</tr>
<? } ?>
<input class="textbox" type="submit" name="Submit" value="update">
</form>
update.php
This is the part where I get confused. I know how to write INSERT and UPDATE statements for anything not in an array, or in a while statement. But for as many checkboxes show up I am lost as to creating an INSERT or UPDATE statement for every checkbox, if checked!
Does anyone know a good tutorial on this? or have some simple way to explain putting arrays into forms and sql statements?
thanks!