mercredi 29 novembre 2017

PHP: Writing an if statement for different custom heads

I am creating a database of clients. I am creating error checks in the search function so that it redirects the user back to the search page if the user doesn't exist. I create a header like this:

header("Location: search.php?search=not-found");

I then want to write an if statement on the search.php page so that if the URL has "?search=not-found" at the end, then it displays an error that the user can see by the search box. Such as (I know this isn't correct):

if(url contains ['search.php?search=not-found']){

echo 'That user doesn't exist';

} else {

echo 'Please search for a user';

}

How do I write this if statement?

Aucun commentaire:

Enregistrer un commentaire