0
<div class="content" style="margin-left:17%;">
 <div class="box box-warning" >
  <div class="box-header with-border" style="margin-left:20%;">
     <h3 class="box-title">Add Package</h3>
   </div><!-- /.box-header -->
  <div class="box-body"  style="margin-left:9%;">
     <div class="row">

<div class="col-md-10" >
<form action="" method="post" accept-charset="utf-8">

<div class="row" >
 <div class="col-md-6">
 <div class="form-group">
 <label for="varchar">Name </label>
 <input type="text" class="form-control" name="name" id="name" placeholder="Name" value="">
   </div>        
 </div> 

 <div class="col-md-6">
  <div class="form-group">
<label for="enum">Status </label>
 <select name="status" class="form-control">
<option value="active">Active</option>
<option value="inactive">Inactive</option>
</select>   
</div>
</div>
</div>

  <div class="form-group" style="margin-left:6%;" >
   <label for="varchar">Tests </label>

<div class="table">
<table class='table table-responsive table-hover' style='margin-bottom: 10px'>
  </div>

 <?php
$conn=mysqli_connect("localhost","root","","laboratory") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());

 $query="SELECT *  FROM test";
 $result=mysqli_query($conn,$query);
 if ($result) {
 while ($record=mysqli_fetch_array($result)) {

  echo "<tr>";
       echo "<td>".$record['name']."</td>";
       echo " <td>".
       "<label class='checkbox'>"."<input type='checkbox' name='checkbox[]' class='roc roc-checkbox-3 package_tests' value='checkbox'>"."<span class='lbl'>"."</span>"."</label>"."</td>";

  echo " </tr>";

}

} 
mysqli_close($conn);
?> 

</table>

 </div>

<div class="row">
     <div class="col-md-4">
<div class="form-group">
 <label for="decimal">Actual Price </label>
  <input type="text" class="form-control" name="price" id="price" placeholder="Actual Price" value="">
   </div>        
   </div>
     <div class="col-md-4">
 <div class="form-group">
 <label for="int">Discount </label>
  <input type="text" class="form-control" name="dprice" id="dprice" placeholder="Discount" value="">
   </div>        
       </div>
<div class="col-md-4">
<div class="form-group">
<label for="decimal">Final Price </label>
 <input type="text" class="form-control" name="fprice" id="fprice" placeholder="Final Price" value="" >
  </div>        
   </div>
  </div>
 <div class="form-group">
 <label for="description">Description </label>
 <textarea class="form-control" rows="3" n" id="description" placeholder="Description"></textarea>
 </div>

<button type="submit" class="btn btn-primary">Add</button> 
 <a href="" class="btn btn-default">Cancel</a>

 </form>
 </div>
 </div>
 </div><!-- /.box-body -->
 </div><!-- /.box -->
  </div>

<?php
$host="localhost";//host name  
$username="root"; //database username  
$word="";//database word  
$db_name="laboratory";//database name  
$tbl_name="package"; //table name  

$con=mysqli_connect("$host", "$username", "$word","$db_name")or die("cannot connect");//connection string  
$checkbox1=$_POST['checkbox'];  
$chk="";  
foreach($checkbox1 as $chk1)  
   {  
      $chk .= $chk1.",";  
   }  
 $in_ch=mysqli_query($con,"insert into  package(technology) values ('$chk')");  
if($in_ch==1)  
   {  
      echo'<script>alert("Inserted Successfully")</script>';  
   }  
else  
   {  
      echo'<script>alert("Failed To Insert")</script>';  
   }  
}  

?>  
2
Contributors
1
Reply
15
Views
1 Week
Discussion Span
Last Post by alan.davies
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.