bhawesh9696 0 Newbie Poster

hey, i am trying to insert multiple checkbox data in my database but having a littlt bit problem. When i am trying to insert checkbox data it inserts only id and nothing else.
Here is my full code:-

<?php 
include("config.php");

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

  $contact_sms = $_POST['contact_sms'];  
  $check[] = $_POST['check'];
  $firm_name = $_POST['firm_name'];
  var_dump($firm_name);
  $checkbox = $_POST['check'];

  for($i=0;$i<count($checkbox);$i++){
    $bulksms="INSERT INTO bulk_sms (sent_sms,firmname_sms,contact_sms) VALUES('".$checkbox[$i]. "','".$row['firm_name']. "','$contact_sms')";
    $smsquery=mysqli_query($conn, $bulksms);
  }
}

$sql="SELECT * FROM inventory_details where status ='0' AND role='0' ORDER BY position ASC, role ASC, visiter DESC limit 0,100";  
$query=mysqli_query($conn, $sql);

?>

    <form method="post" action="" id="msform">   
      <?php
        $i=0;
        while($row=mysqli_fetch_assoc($query)){
        $id = $row['id'];
        $firm_name = $row['firm_name'];
      ?>  

        <div class="col-md-4">
          <input type="text" class="form-control" name="id_sms" value="<?php echo $id;?>">
        </div>
        <div class="col-md-6">
          <input type="text" class="form-control" name="firm_name[]" value="<?php echo $firm_name;?>">
        </div>
        <div class="col-md-2">
          <input type="checkbox" id="checkItem" name="check[]" value="<?php echo "$id"; ?>">
        </div>

      <?php
        $i++;
        }
      ?>

      <input type="text" class="form-control" name="contact_sms" placeholder="Contact Number.."> 
      <button type="submit" class="btn btn-success" name="save">Send</button>

</form>

when i click on Send button , it only stores `id`inside the field `sent_sms` and nothing in field `firm_name`. Please help me out. I am poorly trapped in it.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.