title: can't store session value, using while loop to print row
body: <p>I am using while loop to print tickets for match as scheduled.
  i want to store information in session but it is not working with while loop</p>
  
  <pre><code>&lt;?php
    session_start();
    $_SESSION['name']='set';
    $_SESSION['teama']=$team1;
    $_SESSION['teamb'] = $team2;
  
    $query = "SELECT team1, team2, time, date FROM wb_match"; 
    $result = $db-&gt;prepare($query);
    $result-&gt;execute(); 
    $result-&gt;bind_result($team1, $team2, $time, $date);
    while($result-&gt;fetch()) {
      echo $team1.' - '. $team2.' - '. $date.' - '. $time. '&lt;form method="post" 
      action="selectseat.php"&gt;&lt;input type="submit" value="Buy now" name="buy"/&gt;&lt;/form&gt;';
    }
  ?&gt;
  </code></pre>
  
  <p>output </p>
  
  <blockquote>
    <p>arsenal - balton - 2014-03-15 - 18:00:00[Buy button]</p>
    
    <p>liverpool - Everton - 2014-03-17 - 10:00:00[Buy button]</p>
  </blockquote>
  
  <p>on next page i am checking session continue and printing </p>
  
  <pre><code>&lt;?php  
    session_start();
    $one = $_SESSION['teama'];
    $two = $_SESSION['teamb'];    
  
    if(!isset($_SESSION['name'])){
      echo'not set';
    }
    else 
    if($_SESSION['name']=='set'){
      echo 'Session is set'. $team1;
      echo  $one, $two; 
    }
  ?&gt;
  </code></pre>
  
  <p>print session is set and nothing else.</p>