I have 6 <select>
boxes. I am making a report base on <select>
boxes. What I have done is make a form and and set method to GET and then getting these values through $_GET method on next page. Like
<form method="get" action="report.php">
<select name="select1">
<option value="none">Select value</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select name="select2">
<option value="none">Select value</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select name="select3">
<option value="none">Select value</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
.....................
</form>
Here is PHP code. (These are all sample data :P) Just trying to tell you people my problem. I am getting all values an check if it's value equal to none or not and do this, etc.
if(
$cby == "none"
&& $crequirment == "none"
&& $cdepartment == "none"
&& $period == "none"
&& $ccontact == "none"
&& $cattend == "none"
)
{
$query = mysqli_query($db, "SELECT * FROM customer");
}
else if (
$cby != "none"
&& $crequirment == "none"
&& $cdepartment == "none"
&& $period == "none"
&& $ccontact == "none"
&& $cattend == "none"
)
{
$query = mysqli_query($db, "SELECT * FROM customer WHERE cby = $cby");
}
else if (
$cby == "none"
&& $crequirment == "none"
&& $cdepartment != "none"
&& $period == "none"
&& $ccontact == "none"
&& $cattend == "none")
{
$query = mysqli_query($db, "SELECT * FROM customer WHERE cdepartment = $cdepartment");
}
else if..........
What I want is to make as simple as possible. What method should I have to adopt for it?