# PHP Include

**URL:** <https://www.phphelp.com/t/php-include/18905>\
**Category:** General PHP Help\
**Created:** [November 13, 2012, 6:18pm UTC](https://www.phphelp.com/t/php-include/18905 "2012-11-13T18:18:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://www.phphelp.com/uploads/default/original/2X/2/243e9ed5d93c5653ce3186f18df16e019ce38445.png) [@system](https://www.phphelp.com/u/system)\
**Post date:** [November 13, 2012, 6:18pm UTC](https://www.phphelp.com/t/php-include/18905/1 "2012-11-13T18:18:28Z")

</div>

Just a quick question guys…

I’m using these two lines as part of an Include function:

 

$\_GET[‘page’];

 

Is it possible to ‘GET’ a blank variable, e.g. so I can just link to “?home.php”?

 

Hope that was clear, many thanks 😃

---

<div class="post-metadata">

**Author:** ![m11](https://www.phphelp.com/letter_avatar_proxy/v4/letter/m/85f322/32.png) [@m11](https://www.phphelp.com/u/m11)\
**Post date:** [November 13, 2012, 8:19pm UTC](https://www.phphelp.com/t/php-include/18905/2 "2012-11-13T20:19:51Z")

</div>

I would not include the “.php” or use the filename in your URL. You can do something like this:

[php]  
// example: index.php?mypage

$page = (isset($\_SERVER[‘QUERY\_STRING’]) ? $\_SERVER[‘QUERY\_STRING’] : ‘’);  
switch($page) {  
default:  
// if query\_string is empty or not matching switch  
include(‘include\_home.inc.php’);  
break;  
case ‘mypage’:  
// include mypage.php - notice how filename is different than query\_string  
include(‘include\_mypage.inc.php’);  
break;  
}  
[/php]
