php - unable to get the name of checkbox through $_GET and multiple rows -
i have choices options given in above image. each option can select 1 or can restrict have choose 1 choice each option.
i having problem when select 1 each option not inserting value of 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 name pc
, <?php echo $mitemch_id; ?>
option id if option 1 value 1 , on. how can put name in $_get name given above of checkbox?
and below how using 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 temp_cart (item_id, price_id, qty, ses_mem) values ( '".$insitid."','".$inspr."','".$iqty."','".$ses_mem."' ) "); $last_id = mysql_insert_id(); mysql_query(" insert temp_choices (temp_id, choice_id, item_id, ses_mem) values ( '$last_id','$minsitid','$insitid','$ses_mem' ) ");
i have tried below code loop no use.
for($i=0; $i < count($minsitid); $i++) { mysql_query(" insert temp_choices (temp_id, choice_id, item_id, ses_mem) values ( '$last_id','$minsitid[$i]','$insitid','$ses_mem' ) "); }
change
<input name="pc<?php echo $mitemch_id; ?>" type="checkbox" value="<?php echo $mitemchch_id; ?>">
to
<input name="pc[]" type="checkbox" value="<?php echo $mitemchch_id; ?>">
popup_item_submit_process.php
$pc = $_post['pc']; $totalpc = sizeof($pc); for($i=0;$i<$totalpc;$i++){ $selectedpc = $pc[$i]; //now use `$selectedpc` enter database table. // use query here appropriate column name/values along `$selectedpc`. }
Comments
Post a Comment