# Validating web address with query parameters

**URL:** <https://forum.kirupa.com/t/validating-web-address-with-query-parameters/279359>\
**Category:** programming\
**Created:** [January 13, 2009, 10:39pm UTC](https://forum.kirupa.com/t/validating-web-address-with-query-parameters/279359 "2009-01-13T22:39:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thalamus](https://avatars.discourse-cdn.com/v4/letter/t/0ea827/32.png) [@thalamus](https://forum.kirupa.com/u/thalamus)\
**Post date:** [January 13, 2009, 10:39pm UTC](https://forum.kirupa.com/t/validating-web-address-with-query-parameters/279359/1 "2009-01-13T22:39:55Z")

</div>

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):

```auto
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.
