What do you want to happen if the user enters information into two fields?
1. If you want to make sure that only one field is entered, I'd rather suggest having only one text field, and 3 submit buttons each with a different value.
Example:
Code: Select all
<input type="text" name="search" />
<button type="submit" name="submit" value="level">Level Less Than Search</button>
<button type="submit" name="submit" value="level2">Level Greater Than Search</button>
<button type="submit" name="submit" value="money">Money Search</button>
Then you can check which button was pressed:
Code: Select all
<?php
if($_POST['search'] != "")
{
if($_POST['submit'] == 'level')
{
// code for level less than
}
else if($_POST['submit'] == 'level2')
{
// code for level greater than
}
else if($_POST['submit'] == 'money')
{
// code for money
}
}
?>
If you don't want one text box and multiple buttons, you can also have 3 different forms, each with its own hidden input indicating what that form was meant to do. That way, you avoid having to decide where to go based on which text box was full and which text box was empty.
2. If you instead you want to mix search results if multiple fields are entered either by OR-ing the conditions or AND-ing them, then the approach is completely different.