# Passing variables in a URL to use in include($variable.php);

**URL:** <https://forum.kirupa.com/t/passing-variables-in-a-url-to-use-in-include-variable-php/303180>\
**Category:** programming\
**Created:** [January 15, 2010, 3:05pm UTC](https://forum.kirupa.com/t/passing-variables-in-a-url-to-use-in-include-variable-php/303180 "2010-01-15T15:05:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FlashFish](https://avatars.discourse-cdn.com/v4/letter/f/b9e5f3/32.png) [@FlashFish](https://forum.kirupa.com/u/FlashFish)\
**Post date:** [January 15, 2010, 3:05pm UTC](https://forum.kirupa.com/t/passing-variables-in-a-url-to-use-in-include-variable-php/303180/1 "2010-01-15T15:05:54Z")

</div>

I think the title sums it up, I’m trying to load php content into a main php page based on variables (?pag) sent from the url. These content files also use a variable (?client) to pull info from a database. Everything works on it’s own and I can include the content files with a standard:

include(“overview.php”);

but as soon as I start trying to swap the filename for a variable I get problems. Either I get errors or the main page loads without the content. Can somebody please check my code, this current version prodcues this error. Line 55 is the include.

Parse error: syntax error, unexpected ‘.’ in /homepages/73/d165769927/htdocs/MDWEB/campaignreports/campaignreport.php on line 55

\<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd](http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)”\>  
\<html xmlns=“[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)”\>

\<head\>

\<meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859-1” /\>

\<link href=“style.css” rel=“stylesheet” type=“text/css” /\>  
\</head\>  
\<body\>

\<?php  
$pag = $\_GET[‘pag’];  
$client = $\_GET[‘client’];

print’  
\<div id=“container”\>  
\<div id=“content”\>  
\<div id=“framegallery” style=“width: 860px; height: 100%”\>  
\<img src=“header.jpg” border=“0” usemap="#Map" style=“border:0px;” /\>  
\<map name=“Map” id=“Map”\>  
\<area shape=“rect” coords=“24,69,107,94” href=“[http://www.mysite.tv/campaignreports/campaignreport.php?client=’.$client.’&?pag=overview](http://www.mysite.tv/campaignreports/campaignreport.php?client='.%24client.'&?pag=overview)” alt=“overview” /\>  
\<area shape=“rect” coords=“141,69,275,94” href=“[http://www.mysite.tv/campaignreports/campaignreport.php?client=’.$client.’&?pag=activity](http://www.mysite.tv/campaignreports/campaignreport.php?client='.%24client.'&?pag=activity)” alt=“activity report” /\>  
\<area shape=“rect” coords=“317,67,384,95” href=“[http://www.mysite.tv/campaignreports/campaignreport.php?client=’.$client.’&?pag=gallery](http://www.mysite.tv/campaignreports/campaignreport.php?client='.%24client.'&?pag=gallery)” alt=“gallery” /\>  
\<area shape=“rect” coords=“417,67,509,96” href=“[http://www.mysite.tv/campaignreports/campaignreport.php?client=’.$client.’&?pag=summary](http://www.mysite.tv/campaignreports/campaignreport.php?client='.%24client.'&?pag=summary)” alt=“summary” /\>  
\</map\>  
\<table width=“100%” border=“0” cellpadding=“28” cellspacing=“0”\>  
\<tr\>  
\<td background=“indexfiles/light-trail-LARGE.jpg” STYLE=“background-position: bottom; background-repeat:no-repeat;” bgcolor="#080808"\>

'?\>

\<?php  
include(.$pag.".php");  
?\>

\<br /\>\<br /\>  
\</td\>\</tr\>  
\</table\>  
\</div\>  
\</div\>   
\</div\>  
\</body\>  
\</html\>

Thanks in advance!
