So I have a script (written in PHP) that posts the user input of a reference number and postcode and then redirects the user to a page with the URL parameters like so:
http://mydomain.com/data.php?reference=REF1234&postcode=LE1FEH
The data.php script will then fetch the data from the database according to the URL parameters, but what would I do if the reference number or postcode does not actually exist or match any row in the database – how would I send the user to an error page?
Because when they don’t exist right now, the user is still directed to the data.php page – there is just no data on the page.
// after your query:
Preferably, that page will have some details on the error, you can tack those pieces on to the header if you’d like. Or, you can just show an error on the page that loads the data right there.