Select query not showing with $_SESSION variable
<p>The output isn't showing through the variables in the $userInfo. When I use print_r($_SESSION) it shows all the output in $userInfo for some reason. I set the $_SESSION on the last page and I know it's working. Again when I user print_r to show the session info all the variables show up in $userInfo. </p>

<pre><code>    &lt;?php
    session_start();
    error_reporting (E_ALL ^ E_NOTICE);
    include "convenienttomysql.php";
    //include "convenientglobal2localhost.php";

    if (isset($_SESSION['userId'])) {
      $pid = $_SESSION['userId'];
       $results = mysql_query("SELECT * FROM register WHERE userId='$pid'")or die(mysql_error());

    while($rowp=mysql_fetch_array($results)){

     $address1=$rowp['address1'];
     $address2=ucfirst($rowp['address2']);
     $city=ucfirst($rowp['city']);
     $region=$rowp['region'];
     $postalCode=$rowp['postalCode'];
     $country=$rowp['country'];
     $shippingRegion=$rowp['shippingRegion'];
     $userInfo='&lt;table id="addressTableOutput"&gt;
         &lt;tr&gt;
            &lt;td colspan="2"id="tableTh"&gt; Address Info&lt;/td&gt;
         &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;Address 1:&lt;/td&gt;&lt;td&gt; '.$address1.'&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
        &lt;td&gt;Address 2:&lt;/td&gt;&lt;td&gt; '.$address2.'&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
                &lt;td&gt;City:&lt;/td&gt;&lt;td&gt; '.$city.'&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
           &lt;td&gt; Region:&lt;/td&gt;&lt;td&gt; '.$region.'&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
           &lt;td&gt;Postal Code:&lt;/td&gt;&lt;td&gt; '.$postalCode.'&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
           &lt;td&gt;Country:&lt;/td&gt;&lt;td&gt;'.$country.'&lt;/td&gt;
            &lt;/tr&gt;&lt;tr&gt;
           &lt;td&gt;Shipping Region:&lt;/td&gt;&lt;td&gt; '.$shippingRegion.'&lt;/td&gt;
          &lt;/tr&gt;
            &lt;tr&gt;
               &lt;td id="editTd"&gt;&lt;a id="edit" href="convenienteditaddress.php"&gt;Edit&lt;/a&gt;&lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;';
 }
    }
    $errors= array();

     if (isset($_POST['submit'])){

        $address1=$_POST['address1'];
         $address2 = $_POST['address2'];
        $city = $_POST['city'];
        $region=$_POST['region'];
        $postalCode=$_POST['postalCode'];
        $country=$_POST['country'];
        $shippingRegion=$_POST['shippingRegion'];
        $msg_to_user="";

        if(empty($address1) || empty($city)|| empty($region)|| empty($country)|| empty($shippingRegion)|| empty($postalCode)){

      $errors[] = "&lt;span id='asterisk'&gt;*&lt;/span&gt;All fields need to be filled in.&lt;span id='asterisk'&gt;*&lt;/span&gt;";
        }
        else{
        if(strlen($postalCode) &gt; 5){
        $errors[] ="&lt;span id='asterisk'&gt;*&lt;/span&gt;Postal Code length is 5 characters.&lt;span id='asterisk'&gt;*&lt;/span&gt;";
        }
        if(empty($region)){
        $errors[]="&lt;span id='asterisk'&gt;*&lt;/span&gt;Select a Region.&lt;span id='asterisk'&gt;*&lt;/span&gt;";
        }
        if(empty($shippingRegion)){
        $errors[]="&lt;span id='asterisk'&gt;*&lt;/span&gt;Select a shipping region.&lt;span id='asterisk'&gt;*&lt;/span&gt;";
        }
        if(strlen($country)&lt; 2){
        $errors[]="&lt;span id='asterisk'&gt;*&lt;/span&gt;Please enter a country.&lt;span id='asterisk'&gt;*&lt;/span&gt;";
        }
        }

        if(!empty($errors)){
        foreach($errors as $error){
            $msg_to_user2= "$error";
        }
        }
        else{

    $check = mysql_query("UPDATE register SET address1='$address1',address2='$address2',city='$city',region='$region',postalCode='$postalCode',country='$country',shippingRegion='$shippingRegion' WHERE userId='$pid'")or die(mysql_error());
       }
     }


     ?&gt;

    &lt;html&gt;
    &lt;body&gt;
    &lt;?php echo $userInfo;?&gt;
    &lt;/body&gt;
    &lt;/html&gt; 
</code></pre>
