mysql - PHP - Change value y,n in database -


i try change value y , n, input in database , database got problem, please me solve it. here code

<label>get sponsored <span style="color:red">*</span></label>  <select style="width:100px;" class="form-control" name="sponsor">     <?php                                                 $generic = array('no', 'yes');                                                 for($i=0;$i<count($generic);$i++){                                             ?>                                                     <option value="<?php echo ($i); ?>" <?php echo (isset($row))?(($row->is_get_sponsored ='y'== 1)?"selected":""):"";?>>                                                         <?php echo $generic[$i];?>                                                     </option>                                             <?php                                                 }                                             ?> </option>  </select> 

hope need this.

<?php $row->is_sponsored_by = 'y';//already stored value $dropdnarr = array('y' => 'yes', 'n' => 'no');//say y & n storing db , yes & no display echo "selected value ={$row->is_sponsored_by}<br/>";  ?>  <label>get sponsored <span style="color:red">*</span></label> <select style="width:100px;" class="form-control" name="sponsor"> <?php     foreach ($dropdnarr $key => $value) {?>         <option value="<?php echo $key;?>"                  <?php echo (isset($row)) ? (($row->is_sponsored_by == $key) ? "selected" : "") : "";?> >             <?php echo $value;?>         </option> <?php     } ?> </select> 

Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -