# Validating PHP URL variables

**URL:** <https://forum.kirupa.com/t/validating-php-url-variables/203389>\
**Category:** programming\
**Created:** [October 10, 2006, 6:16pm UTC](https://forum.kirupa.com/t/validating-php-url-variables/203389 "2006-10-10T18:16:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BadBadNeil](https://avatars.discourse-cdn.com/v4/letter/b/f4b2a3/32.png) [@BadBadNeil](https://forum.kirupa.com/u/BadBadNeil)\
**Post date:** [October 10, 2006, 6:16pm UTC](https://forum.kirupa.com/t/validating-php-url-variables/203389/1 "2006-10-10T18:16:54Z")

</div>

Hello,  
Hopefully this is a simple problem.

I have php page using includes that load content via url variables similar to

[http://www.mywebsite.com/main.php?page=services&title=servicesTitle](http://www.mywebsite.com/main.php?page=services&title=servicesTitle)

Right now if someone manually changes the variables in the url to say  
[http://localhost/main.php?page=services&title=fake](http://localhost/main.php?page=services&title=fake)  
it still loads the page minus the include content because the variable is wrong.

How do I check to make sure that the variable contents are correct and if not send them to an error page?

Thanks!
