select option selection in php -
i have form input order, there 2 fields, branch , customer model. before click button "search", must select branch , customer fields. after filled field, click button search, data appears. problem is, after data appears, condition branch , customer models filled, want create search, changed branch field (customer model field same previous search), change branch field 'a' 'b' , click button search, data not appears / empty (whereas data exists in database). branch field,the field when changed b, after click button search, branch filled changed
'select'
(branch option select -> , b).
i'm confused problem.. here code :
<?php if ($_post) { $_session['data_id'] = $_post['data_id']; $_session['branch'] = $_post['branch']; $_session['customer_model'] = $_post['customer_model']; } ?> <form id="search" class="formular" method="post" action="search_data.php" style="z-index:1;"> <table width="100%"> <tr> <td>data id :</td> <td><input type="text" name="data_id" value="<?php echo $_session['data_id'];?>"></td> </tr> <tr> <?php $branch = "'".str_replace(",", "','", $_session['moi_status_userbranch'])."'"; $check_data = $db->getall("select cab_id, cabang_name company_profile cab_id in(".$branch.")"); ?> <td>branch :</td> <td> <select id="branch" name="branch"> <option value="0">select</option> <?php foreach($check_data $row): ?> <option <?php echo ($_session['branch'] == $row['cab_id']) ? "selected" : ""; ?> value="<?php echo $row['cab_id']; ?>"><?php echo $row['cabang_name']; ?></option> <?php endforeach; ?> </select> </td> </tr> <tr> <td width="110">customer model</td> <td> <select id="customer_model" name="customer_model" class="readonly validate[required]"> <option <?php echo ($_session['customer_model'] == '0') ? "selected" : ""; ?> value="0">pilih</option> <option <?php echo ($_session['customer_model'] == 'i') ? "selected" : ""; ?> value="i">personal</option> <option <?php echo ($_session['customer_model'] == 'c') ? "selected" : ""; ?> value="c">corporate</option> </select> </td> </tr> </table> <input type="submit" id="btnsubmits" name="btnsubmit" class="button" value="search" /> <a onclick="mypopup();" style="text-decoration:underline; cursor:pointer; font-weight:bolder">add new</a> </form> <script> function mypopup() { <?php unset($_session['regional_saved']); ?> mywindow = window.open("choose_custtype.php" ,"item","width=700px,height=350px,resizable=1,scrollbars=1,top=150,left=200"); mywindow.moveto(200, 200); }
Comments
Post a Comment