title: Passing URL Parameters to WordPress PHP Template Page
body: <p>I am trying to pass URL parameters to a Wordpress template page:</p>
  
  <pre><code>www.mysite.com/my_wp_page_template/?city=Anytown&amp;state=ST
  </code></pre>
  
  <p>Based on some forum examples I have added the following code to the functions.php:</p>
  
  <pre><code>add_filter('query_vars', 'parameter_queryvars' );
  function parameter_queryvars( $qvars )
  {
    $qvars[] = 'City';
    $qvars[] .= 'State';
    return $qvars;
  }
  </code></pre>
  
  <p>And, I am trying to extract the variables in a PHP file that is included in a WP page using:</p>
  
  <pre><code>report_for_city.php
  &lt;?php
  $strCity = $_GET["City"]; 
  $strState = $_GET["State"];
  $strCityState = $strCity . ' ' . $strState;
  ?&gt;
  &lt;p&gt;This page contains the report for &lt;?php $strCityState ?&gt;.&lt;/p&gt;
  </code></pre>
  
  <p>But, the variable is not getting inserted in the output HTML.  The HTML is being inserted into the WP page, so the PHP template is getting invoked from the WP page using the insert-php plugin:</p>
  
  <pre><code>[insert_php]include('wp-content/php/report_for_city.php');[/insert_php]
  </code></pre>
  
  <p>What am I doing wrong?  How can this be fixed?</p>