I want to make form where user can search certain info based on their input and choices.after all the form filling the data will be display using table..got error with my implode where it gave me warning implode(): Invalid arguments passed in line 111 which is
$check = implode("','", $_POST['check_list']);
and after that i tried tick two values on checkbox it gave me mysql_fetch_array() expects parameter 1 to be resource, boolean given in line 125 which is
while($row = mysql_fetch_array($sql)) {
.
<form method="post">
<div class="form-group">
<h3><label for="usr">Carian bajet anda:</label></h3>
<div class= "col-md-12">
<div class=" col-md-4"></div>
<div class=" col-md-4">
<input name="bajet" type="text" class="form-control" id="usr"></div>
</div>
<div class=" col-md-4"></div>
</div><br>
<h3><label for="sel1">Pilih negeri pilihan anda:</label></h3>
<div class= "col-md-12">
<div class=" col-md-4"></div>
<div class=" col-md-4">
<select class="form-control" name="sel">
<option>Kuala Lumpur</option>
<option>Negeri Sembilan</option>
<option>Pahang</option>
<option>Perak</option>
<option>Terengganu</option>
<option>Selangor</option>
</select>
</div>
<div class=" col-md-4"></div>
</div><br>
<br>
<h5><label for="check">Senarai Pra-perkahwinan:</label></h5>
<center> <div class="checkbox">
<label class="checkbox-inline"> <input type="checkbox"name="check_list[]" value="Jurufoto"><label>Jurufoto</label></label>
<label class="checkbox-inline"> <input type="checkbox"name="check_list[]" value="Butik"><label>Butik</label></label>
<label class="checkbox-inline"> <input type="checkbox"name="check_list[]" value="Hiburan"><label>Hiburan</label></label>
<label class="checkbox-inline"> <input type="checkbox"name="check_list[]" value="Kad Kahwin"><label>Kad Kahwin</label></label>
<label class="checkbox-inline"> <input type="checkbox"name="check_list[]" value="Katering"><label>Katering</label></label>
<br>
</center>
<div class="col-md-4"></div>
<div class="col-md-4">
<button class="btn btn-success btn-sm" name="search">Search <span class="glyphicon glyphicon-search"></span></button><br><br>
</div>
<div class="col-md-4"></div>
</div>
</form>
<table class="table table-bordered">
<thead>
<tr>
<th>Jenis</th>
<th>Vendor</th>
<th>Negeri</th>
<th>No.</th>
<th>Pakej</th>
<th>Harga</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$check = array();
$budget = $_POST['bajet'];
$select = $_POST['sel'];
$check = implode("','", $_POST['check_list']);
$finalCheck = "'".$check."'";
$check = array();
if (isset($_POST['search'])) {
mysql_select_db($database_conn, $conn);
$sql = mysql_query(" SELECT *
FROM vendor
RIGHT JOIN item
ON vendor.v_id=item.v_id
WHERE item.harga <= '%". $budget . "%'
AND vendor.state = '%". $select ."%'
AND vendor.type IN ('%". $finalCheck ." %')" );
while($row = mysql_fetch_array($sql)) {
?>
<tr>
<td><?php echo $row['type'] ?></td>
<td><?php echo $row['companyName'] ?></td>
<td><?php echo $row['state'] ?></td>
<td><?php echo $row['contact'] ?></td>
<td><?php echo $row['harga'] ?></td>
<td><?php echo $row['pakej'] ?></td>
<td><a href="index.php?v_id=<?php echo $row['v_id']?>">View Package</a></td>
</tr>
<?php }
}
print_r($_POST['check_list'] );
?>
</tbody>
</table>
</div>