mardi 5 janvier 2016

Not getting value from of check box after submit

I want to get value of check box after submitting the form.Here is my code.I think the problem is in id or name.what should i do to get value and update that in database?

  if(isset($_POST['submit'])) 
  {

  $check=$_POST['cbox'];
  global $mysqli;
  $query="Update `account_detail` set `proxy_us`=$check  where `id`='".$_SESSION['account_id']."'";
  $res= $mysqli->query($query) or die($mysqli->error);


  }
  <div class="clear">&nbsp;</div>
<div class="dashboard">

    <?php
      global $mysqli;
      $query="select  `proxy_us` FROM `account_detail` where `id`='".$_SESSION['account_id']."'";
      $res= $mysqli->query($query) or die($mysqli->error);
      $row=$res->fetch_array(MYSQLI_ASSOC);
      $us_proxy=$row['proxy_us'];
      ?>

<div id="proxy">
    <form name="cbox" id="cbox" method="post" action="">

    <input type="checkbox" name="cbox" id="cbox" value="Y" <?php if($row['proxy_us']=="Y"){?> checked <?php } ?> style="margin-left:10px;margin:4px"><b>Use Default-Proxy provided by MobilePBX for calls to US.</b>
    <input type="submit" class="btn" style="margin:3px 10px 3px 10px" value="submit">
    </form>
  </div>
  </div>    




Aucun commentaire:

Enregistrer un commentaire