i do have the choices options as given in above image. From each option you can select one or we can restrict that you have to choose one choice from each option.
I am having problem when i select one from each option it is not inserting the value of that checkbox.
<input name="pc<?php echo $mitemch_id; ?>" type="checkbox" value="<?php echo $mitemchch_id; ?>">
<font size="2"><?php echo $mitemch_enm; echo " KD: "; echo $mitemch_prit; ?></font>
In the name PC
and this <?php echo $mitemch_id; ?>
is the option id if option 1 then the value will be 1 and so on. how i can put the name in $_GET for the name given as above of a checkbox?
and below is how i am using to save:
$minsitID = mysql_real_escape_string($_POST['mitemID']);
$insitID = mysql_real_escape_string($_POST['itemID']);
$inspr = mysql_real_escape_string($_POST['op']);
$iqty = mysql_real_escape_string($_POST['qty']);
$ses_mem = session_id();
mysql_query("
insert into temp_cart (item_id, price_id, qty, ses_mem) values (
'".$insitID."','".$inspr."','".$iqty."','".$ses_mem."'
)
");
$last_id = mysql_insert_id();
mysql_query("
insert into temp_choices (temp_id, choice_id, item_id, ses_mem) values (
'$last_id','$minsitID','$insitID','$ses_mem'
)
");
i have tried the below code with for loop but no use.
for($i=0; $i < count($minsitID); $i++) {
mysql_query("
insert into temp_choices (temp_id, choice_id, item_id, ses_mem) values (
'$last_id','$minsitID[$i]','$insitID','$ses_mem'
)
");
}
Aucun commentaire:
Enregistrer un commentaire