Hello:
I’m working with an URL with this query string at the end:
/page/?item=01x-001/
I want to check to make sure the parameter “item” exists in the address, and that it is displayed (entered) correctly in the address bar (“item” and not, e.g. “ite9m”);
Right now my validation code has this structure (quasi-code):
if (isset($_GET['item']) {
(find item number in XML file)
if (found) {
(echo data from XML file)
} else {
echo 'Address doesn't exist';
}
} else {
(echo general content for /page/)
}
Currently, if the value for “item” is invalid or the question mark or trailing slash are missing, the code echoes ‘Address doesn’t exist.’ which is fine.
However, if the parameter itself is not “item” or if the equals sign is missing, the code goes to the last else statement instead of echoing ‘Address doesn’t exist.’
I need more/different code to check for these other errors.