I have the following form
<FORM NAME="form1" METHOD="POST">
<?php do { ?>
<input name="approve[]" type="checkbox" id="approve[]" value="<?php echo
$row_rs['ID']; ?>">
<select name="select">
<option value="1">optio n 1</option>
<option value="2">optio n 2</option>
<option value="3">optio n 3</option>
</select>
<?php } while ($row_rs = mysql_fetch_ass oc($rs)); ?>
</FORM>
I want to acheive a loop that inserts a record into a database that enters
the id and the value they have selected (if the approve input box was
ticked)
so far I have this:
<?
foreach($approv e as $aID) {
$insertSQL = "INSERT INTO TABLE('refID',' optionSelected' ) VALUES
('$aID','')";
}
?>
How do I enter the select value within this loop?
I assumed that it would be just
$insertSQL = "INSERT INTO TABLE('refID',' optionSelected' ) VALUES
('$aID','$selec t')";
But how does the form know what select item is associated with what ID
Hope this makes sense
any help would be grateful
Craig
<FORM NAME="form1" METHOD="POST">
<?php do { ?>
<input name="approve[]" type="checkbox" id="approve[]" value="<?php echo
$row_rs['ID']; ?>">
<select name="select">
<option value="1">optio n 1</option>
<option value="2">optio n 2</option>
<option value="3">optio n 3</option>
</select>
<?php } while ($row_rs = mysql_fetch_ass oc($rs)); ?>
</FORM>
I want to acheive a loop that inserts a record into a database that enters
the id and the value they have selected (if the approve input box was
ticked)
so far I have this:
<?
foreach($approv e as $aID) {
$insertSQL = "INSERT INTO TABLE('refID',' optionSelected' ) VALUES
('$aID','')";
}
?>
How do I enter the select value within this loop?
I assumed that it would be just
$insertSQL = "INSERT INTO TABLE('refID',' optionSelected' ) VALUES
('$aID','$selec t')";
But how does the form know what select item is associated with what ID
Hope this makes sense
any help would be grateful
Craig
Comment