Hi my first insert statment works ok, My problem is that I wish to insert all the selected options passed from the form. into my user_req_opt table. Some items only have 1 option others may have 10 options.
$sql = "insert into user_requests(rq_id, user_id, code_ref, code_id, cat_id, opt_yn, rq_qty, rq_unit, rq_type, rq_date) values(null, '$user_id', '".$_POST[code_ref]."', '".$_POST[code_id]."', '".$_POST[cat_id]."', '".$_POST[opt_yn]."', '".$_POST[rq_qty]."', 'ea', 'code', now())";
$res = mysqli_query($mysqli, $sql) or die (mysqli_error($mysqli));
$qid = mysqli_insert_id($mysqli);
if($_POST[opt_yn] != 'n'){
$opt = "insert into user_req_opt(rq_id, opt_ref, opt_value) values('".$qid."', '".$_POST[opt_ref]."', '".$_POST[opt_value]."')";
$result = mysqli_query($mysqli, $opt) or die (mysqli_error($mysqli));