Yeah I know I can use a select box, (that's the way I currently have it set up), however, I am implementing a flash header and want to be able to input anything into the text box and have php figure out what it is before searching the database...
I got it working as follows:
// Figure out what we're searching by here: pid, last name or phone number?
if(is_numeric($search_by)){
$search_by = "pid";
}
else{
if($dash = strpos($search_by, "-")){
$sides = explode("-", $search_by);
if(is_numeric($sides[0]) AND is_numeric($sides[1])){
$search_by = "phone";
}
else{
$search_by = "last_name";
}
}
else{
$search_by = "last_name";
}
}
Not pretty but it works... thanks for the help and ideas! Bodzan I had an error on your ereg statement when I tried it. I suck with those things so I did it a different way.