# Error check for $\_GET

**URL:** <https://forum.kirupa.com/t/error-check-for--get/296344>\
**Category:** programming\
**Created:** [September 13, 2009, 11:58pm UTC](https://forum.kirupa.com/t/error-check-for--get/296344 "2009-09-13T23:58:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyg3r](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tyg3r/32/1341_2.png) [@Tyg3r](https://forum.kirupa.com/u/Tyg3r)\
**Post date:** [September 13, 2009, 11:58pm UTC](https://forum.kirupa.com/t/error-check-for--get/296344/1 "2009-09-13T23:58:23Z")

</div>

Hi

I’m really new to PHP, so forgive my lack of proper terminology.

Basically, I have a php script that is creating a few variables using $\_GET. But I was wondering if there is a way to create a default variable when the parameter isn’t in the URL to begin with.

For example if the url was something like: “[ww.somewebsite.com/form.php?name=john&surname=smith](http://ww.somewebsite.com/form.php?name=john&surname=smith)”

And php script was something like this:

```auto
$name = $_GET['name'];
$surname = $_GET['surname'];

if ($_GET['company'] == DOESNT-EXIST){
  $company = "no company";
} else {
  $company = $_GET['company'];
}

```

Any help would be greatly appreciated. Cheers.

Mark
