I'm trying to figure out how can i display the value from several text field and it will be recorded on the database. am i going to use an array?
it's a code to determine the quantity of the items listed and which of the items is to be replace that's why i used checkbox.
I hope i explained it well. Thanks.
<form name="quantity" action="page2.php" method="POST">
<?php
while($rows=mysql_fetch_array($select_result, MYSQL_ASSOC)){
?>
<tr>
<td><?php echo $rows['item_id'];?></td>
<td><?php echo $rows['item_name'];?></td>
<td><input type = "text" size = "5" name = "item_qty[]" value="0"></td> //Input quantity
<td><input type="checkbox" name="checkbox[]" id="checkbox[]" value="<?php echo $rows['item_id']; ?>"></td>
</tr>
<?php
}
?>
</table>
<br>
<input type="submit" value="submit" name="submit" id="submit">
<input type="reset" value="Clear" name="rset">
<?php
if($_POST['submit']){
$checkbox = $_POST['checkbox'];
$countCheck = count($_POST['checkbox']);
for($i=0; $i<$countCheck; $i++){
$select_id = $checkbox[$i];
$select_query = "SELECT FROM item WHERE item_id='$select_id'";
$select_result = mysql_query($select_query);
}
}
?>
</form>