title: page needs to be refresh to load the content
body: <p>i have a shopping website. in that when we click a particular product it will take the id of that product and will load another page using that id. but when i open the website and click any product that page is not displaying. it keeps on loading. when i reload it works fine. it happens only the first time. after that the page displays when i click the product. please help me. thanks in advance</p>
  
  <p>i have attached the code of the page</p>
  
  <pre><code>     $id = $_GET['id'];
     $_SESSION['abaya']= $id;
  </code></pre>
  
  <p>Above code is where i get the id. i have attached that particular page below</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;&lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;Abayat Dubai&lt;/title&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"&gt; 
  
  
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;section id="portfolio" class="portfolio"&gt;
  &lt;div class="container"&gt;
  
  &lt;div class="row"&gt;
  
  
          &lt;div class="span6" style="float:left"&gt;
  
  
  
              &lt;?php
  $code="{$_SESSION['abaya']}";  
  ?&gt;  
  
  
                 &lt;!--begin span4 --&gt;
  
                     &lt;div class="view view-first" id="frockone"&gt;
  
                             &lt;img src="images/photos/&lt;?php echo"$code";?&gt;.jpg" alt="frock"&gt;
  
  
                     &lt;/div&gt;
  
  
          &lt;/div&gt;
  
  
          &lt;div class="span5" style="float: right; padding-left:5%"&gt;
  
  
          &lt;?php
          $query="SELECT * FROM s_product WHERE code='$code';";
  $result=mysql_query($query)
  or die("could not perform query");
  $name="{$_SESSION['country']}";
  $price="error";
  
  while($row=mysql_fetch_array($result,MYSQL_ASSOC))
  {
  $p_name="{$row['img_name']}";
  ?&gt; 
  
          &lt;h4&gt;&lt;?php echo"{$row['img_name']}";?&gt;&lt;/h4&gt;
  
  
          &lt;p&gt;Description : &lt;?php echo"{$row['description']}";?&gt; &lt;/p&gt;
  
  
  
  
  
  
          &lt;?php if($name=="sri"){
  
                                  $currency="LKR ";
  $price="{$row['sri_price']}";
  
                 }
  elseif($name=="uae"){
  
                                  $currency="AED ";
  $price="{$row['price']}";
  
  }
  
  elseif($name=="australia"){
  $currency="AUD ";
  $price="{$row['australia_price']}";
  }
  else{
  $currency="USD ";
  $price="{$row['usa_price']}";
  }?&gt;
  
            &lt;h6 style="color:#a62b6d; font-size:18px"&gt; &lt;span&gt;&lt;?php echo"$currency","$price"?&gt;&lt;/span&gt;&lt;/h6&gt;
  
  
         &lt;?php 
  $price_us="{$row['usa_price']}";
  
  break;
  }?&gt;
         &lt;hr&gt;
          &lt;div&gt;
  
  
  
  &lt;form name="product" method="post" action="pro.php"&gt;
  
         &lt;select name="quantity" style="width:100px; padding:2%"&gt;
    &lt;option selected="selected" value=""&gt;Quantity&lt;/option&gt;
  &lt;option value="1"&gt;1&lt;/option&gt;
  &lt;option value="2"&gt;2&lt;/option&gt;
    &lt;option value="3"&gt;3&lt;/option&gt;
                      &lt;option value="4"&gt;4&lt;/option&gt;
    &lt;option value="5"&gt;5&lt;/option&gt;
  
  &lt;/select&gt;&lt;br /&gt;
  
  
  
              &lt;select name="size" style="width:100px; padding:2%"&gt;
    &lt;option selected="selected" value=""&gt;Size&lt;/option&gt;
  
  &lt;option value="50"&gt;50&lt;/option&gt;
    &lt;option value="52"&gt;52&lt;/option&gt;
    &lt;option value="54"&gt;54&lt;/option&gt;
                      &lt;option value="56"&gt;56&lt;/option&gt;
    &lt;option value="58"&gt;58&lt;/option&gt;
  &lt;/select&gt;
  &lt;br /&gt;&lt;br /&gt;
           &lt;input type="submit" class="btn btn-small btn-primary btn-embossed but" value="Add To Bag"  onclick="return validate()" name="add_cart" style="margin-right:5%"/&gt;
  
  
   &lt;a href="sale_home.php"&gt; Continue shopping!&lt;/a&gt;
  
  
  
           &lt;br /&gt;
  
  
   &lt;/form&gt;
  
  
  &lt;?php  
  if(isset($_SESSION['user_tempid']))
  {?&gt;
  &lt;?php }else{
  date_default_timezone_set('Asia/Dubai');
  $today = date("Y-m-d H:i:s");  
  $_SESSION['user_tempid']="$today";
  $i=1;
  $query8="select * from temp_id;";
      $result8=mysql_query($query8) or die("can not login");
      while($row=mysql_fetch_array($result8,MYSQL_ASSOC)){
  
  if($row['id']=="$today"){
  $_SESSION['user_tempid']="$today$i";
  $i++;
  }
  }
  }
   ?&gt;
  
  
  
  
    &lt;?php
  if(isset($_POST["add_cart"]))
  {  
  $quantity=$_POST["quantity"];
  $size=$_POST["size"];
  $cost=$quantity*$price;
  $usd=$quantity*$price_us;
  $query="INSERT INTO  temp_cartitem(user_id,product_id,size,quantity,ori_price,cost,product_name,currency,usd)  VALUES('{$_SESSION['user_tempid']}','$code','$size','$quantity','$price','$cost','$p_name','$currency','$usd')";
   $result= mysql_query($query) or die("failed to insert your record"); 
  
  
  
  
  
   //header('location:cart.php');
     }
   ?&gt;
  
  
  
  
          &lt;/div&gt;
  
           &lt;hr&gt;
  
  
  
  
  
  
  
          &lt;/div&gt;
  
  &lt;/div&gt;
  
  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
  
  
              &lt;!--end small list--&gt;
   &lt;/div&gt;
  &lt;/section&gt;
  
  
  &lt;/div&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>