I’m trying to figure out a way to have custom input variables for a $_POST search form.
so let’s say the user inputs
“user:” – into the search field, it will search for a user.
“battle:” – it searches for a battle
“sample:” it searches for a sample. Etc.
How do I go about using the $_POST method? I was thinking about
$user_search_check = (!empty($_POST['searchbox'])){
if (beginning of line first five letters are 'user:'){
$user_search = "true";
}
}
then to use it I would say
if ($user_search == "true"){
// RUN SELECT SCRIPT FOR MYSQL
}
But i’m not sure on how to get the first five letter. Or should I just take off everything BUT the first five letters and check if it says user?
As always, any help much appreciated and thanks in advance 🙂
1 Answer