For your first Question:
My suggestion would be - alter your table to have a STATE_REPS column rather than 5 individual STATE_REP1, etc. columns. Then, in the STATE_REPS column, the values entered would be "CA,NV,AZ,UT". Seperate them out however you want it doesn't really matter (commas, hyphens, no difference). Your SQL will cover this - The new SQL would be:
$query = "select * from PI_LE_OEMSALES where STATE_REPS like '%".$searchterm."%'";
If you don't know much about SQL, the % are "wild" characters which can stand for anything. Basically it will find any instance of your $searchterm variable in the STATE_REPS column. So if the user searched for CA then anytime the character sequence of "CA" came up (even if the word CAT were in the column as a choice) it would pull out that address as a matching case.
For question 2 - I can't think of any other way to determine if an address has a PO BOX in it than an if statement. You could use the strcmp() function but that would still require an if statement to determine if there is a PO BOX or not.
For question 3 - I use javascript for this sort of thing. For your form rather than making the button
<input type="submit" value="Search">
change it to
<input type="button" value="Search" onclick="search()">
Then in your javascript - you could use a function similar to the following:
function search() {
/* myForm is the name of your form and searchterm is the dropdown list
*/
var state = document.myForm.searchterm.value
window.open("search.php?term="+state, "newWin", "toolbar=no, status=no, location=no, copyhistory=no, scrollbars=no, width=350, height=350, top=100, left=100")
}
Either that or you could just add - target="blank" - to your <form method="post" action="search.php"> line of code (like so: <form method="post" action="search.php" target="blank">)
I like having control over the window however so I prefer the first method.
Hope this helps! 😃
Nathan