Anyone can help? Here is two search by radio button one is requirement type and another radio button is build. I want to search by requirement type or build but it doesn't work...anyone can help to solve this problem, im very stuck! I've been doing this for two days.. I need to submit this code before 5pm today :'(((
<?php
include'Database.php';
?> <!Doctype html> <html> <head> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script type="text/javascript">
function requirementtype() {
if(document.form.valueToSearch.value==''){
alert("Please Choose Requirement Type");
return false;
}
document.form.submit();
}
</script> <body> <center> <ul>
<a method="post" id="form" name="form" >
<table width="50%" border="0" align="center">
<thead>
<div align="left" id="txtHint">
</div>
<td width="10" align="left">
</td> <td width="30" align="left" bgcolor="#99CCFF">
<strong>
<font size="3" face="Palatino Linotype, Book Antiqua, Palatino, serif">Search by Requirement Type:</font></strong>
</td>
<br>
<td width="150" align="left" bgcolor="#99CCFF">
<input type="radio" name="valueToSearch" id="valueToSearch" value="Desktop">Desktop
<input type="radio" name="valueToSearch" id="valueToSearch" value="Laptop" />Laptop
<input type="radio" name="valueToSearch" id="valueToSearch" value="Scanner" />Scanner
</font>
</label>
</td>
<td width="10" align="left">
</td> <td width="30" align="left" bgcolor="#99CCFF"><strong><font size="3" face="Palatino Linotype, Book Antiqua, Palatino, serif">Search by Building:</font></strong></td>
<td width="150" align="left" bgcolor="#99CCFF"> <input type="radio" name="buildvalueToSearch" id="valueToSearch" value="ha1">HA1
<input type="radio" name="buildvalueToSearch" id="valueToSearch" value="ha2" />HA2
<input type="radio" name="buildvalueToSearch" id="valueToSearch" value="ha3" />HA3
</font>
</label>
</td>
</thead>
</table>
</center>
<br>
<center>
<input type="submit" name="search" value="submit">
</center> </table>
<?php
if(isset($_POST['search']))
{
$valueToSearch = $_POST['requirementtype' 'build' ];
$sql = "SELECT * FROM register LIKE requirementtype '%".$valueToSearch."%'";
$res= mysqli_query($dbconfig, $sql);
$num_rows=mysqli_num_rows($res);
if ($num_rows==0)
echo"<div align=center><font color=red size=5><B>NO DATA EXIST.</B></div><br>";
?>
<center>
<p>
<table class = "registration" id="daftar" width = "80%" border = "1" cellspacing = "1" cellpadding = "1">
<tr>
<th>NO</th>
<th>BUILDING</th>
<th>USER</th>
<th>POSITION</th>
<th>SERIAL NUMBER</th>
<th>DEPARTMENT</th>
<th>TAGGING NUMBER</th>
<th>DELIVERY DATE</th>
<th>LOCATION</th>
<th>REMARKS</th>
<th>ASSET STATUS</th>
<th>REQUIREMENT TYPE</th>
<th>EDIT</th>
<th>DELETE</th>
</tr>
<?php
$counter = 0;
while ($userRow=mysqli_fetch_assoc($res)) {
$ptb12 = $userRow['build'];
$ptb2 = $userRow['user'];
$ptb3 = $userRow['position'];
$ptb4 = $userRow['serialnumber'];
$ptb5 = $userRow['department'];
$ptb6 = $userRow['taggingno'];
$ptb7 =$userRow['deliverydate'];
$ptb8 = $userRow['location'];
$ptb9 = $userRow['remarks'];
$ptb10 = $userRow['assetstatus'];
$ptb11 = $userRow['requirementtype'];
$ptb13 = $userRow['id'];
$counter++;
?>
<tr>
<td> <?php echo "$ptb12";?></td>
<td> <?php echo "$ptb2";?></td>
<td> <?php echo "$ptb3";?></td>
<td> <?php echo "$ptb4";?></td>
<td> <?php echo "$ptb5";?></td>
<td> <?php echo "$ptb6";?></td>
<td> <?php echo "$ptb7";?></td>
<td> <?php echo "$ptb8";?></td>
<td> <?php echo "$ptb9";?></td>
<td> <?php echo "$ptb10";?></td>
<td> <?php echo "$ptb11";?></td>
<td> <button><a href="edit.php?id=<?php echo $ptb12; ?>" class="edit_btn" >Edit</a></button></td>
<td> <button><a href="deletepc.php?id=<?php echo $ptb12; ?>">Delete</a></button></td>
</td>
</tr>
<?php } ?>
</table>
</form>
</p>
</center>
</center>
<?php }?>
</body>
</head>
</html>