title: Sending php variable to another php page
body: <p>I need a little help with some coding. I have a page named <code>index.php</code> and a <code>picture.php</code>.</p>
  
  <h3>index.php</h3>
  
  <pre><code>$pid = 0;
  
  for($ctr = 1; $ctr &lt;= 2; $ctr++)
  {
      echo '&lt;tr&gt;';
      $pid++;
  
      echo '&lt;td&gt;';
      echo '&lt;a id="various3" href="picture.php" title="try" idno="5"&gt;&lt;img src="picture.php" width="150" height="210"&gt;';
      //echo '&lt;br&gt;'.$pagenm;
      echo '&lt;/td&gt;';
  
      echo '&lt;/td&gt;';
      echo '&lt;/tr&gt;';
  }
  </code></pre>
  
  <p>After <code>$pid++</code> is executed, I want its value to be sent to <code>picture.php</code>, so that it can be used for a retrieving query.</p>
  
  <h3>picture.php</h3>
  
  <pre><code>$host = 'localhost';
  $user = 'root';
  $pw = '';
  $db = 'thepillar';
  
  mysql_connect($host, $user, $pw);
  mysql_select_db($db);
  $sql = "select pics, ext from infopics where id='5'";
  // mysql_real_escape_string($sql, mysql_connect);
  $result = mysql_query($sql) or die('Bad query at 12!' . mysql_error());
  while ( $row = mysql_fetch_array($result, MYSQL_ASSOC) ) {
      $db_img = $row['pics'];
      $type = $row['ext'];
  }
  $img = base64_decode($db_img); // print_r($db_img );
  $img = imagecreatefromstring($img);
  header("Content-Type: image/jpeg");
  imagejpeg($img);
  imagedestroy($img);
  </code></pre>
  
  <p>I have only assigned 5 as the id to be used to retrieve the image from the database. This is because I don't know how to fetch <code>$pid</code> from <code>index.php</code> and assign it to a variable which I can use in my SQL query.</p>
  
  <p>Any help would be much appreciated. Thanks in advance.</p>