title: PHP Sessions on facebook Tab application
body: <p>i 've built an app on facebook, and i am trying to insert correct info on database.
  The info gets inserted,but something has gone wrong with the sessions in my code(not facebook sessions for users)
  It seems that if two different machines have entered the iframe app,it only creates 1 session and it does not store product correcty.</p>
  
  <p>Here: (first page) - product-check.php I start the session.</p>
  
  <pre><code>session_start();
  </code></pre>
  
  <p>Then (Second Page) - form.php :</p>
  
  <pre><code>    require 'facebook.php';
      session_start();
     if (isset($_REQUEST['product']) == NULL)
     {
     header ("location: product-check.php");
     }
     else
     {
     $product = $_REQUEST['product'];
     //let's start the session
     //Posted Values stored in session
     $_SESSION['product'] = $product;
  </code></pre>
  
  <p>Then on third page i make the insert with values from both pages - product-check and form.</p>
  
  <pre><code>    session_start();
      $link = mysql_connect('With the right credentials') or die(mysql_error());
      mysql_set_charset('utf8',$link);
      $db_selected = mysql_select_db('application', $link);
     $product = mysql_real_escape_string($_SESSION['product']);
     if (isset($_POST['name'])){$name = mysql_real_escape_string($_POST['name']);}   
     if (isset($_POST['surname'])){$surname = mysql_real_escape_string($_POST['surname']);} 
     if (isset($_POST['email'])){$email = mysql_real_escape_string($_POST['email']);}
     if (isset($_POST['term'])){$accept_terms =   mysql_real_escape_string("N");}else{$accept_terms = mysql_real_escape_string("Y");}
     if (isset($_POST['contact'])){$accept_newsletter =   mysql_real_escape_string("Y");}else{$accept_newsletter = mysql_real_escape_string("N");}
     $query_insert = "INSERT INTO app(database fields) 
       VALUES(the above values i have declared)";
       $result = mysql_query($query_insert);
       mysql_close($link);
        session_destroy();
  </code></pre>
  
  <p>That is it.But not all of the products from product-check.php appear in database.</p>