title: How can I get a results page using bind params to return query from drop down
body: <p>I'm working through an online tutorial to rewrite my results page using bind params. I thought I understood it fairly well but I can't get it to work so obviously, I don't. I've tried everything I thought logical plus some things that were not but still all I get is a blank page.
  This is the drop down.</p>
  
  <pre><code> &lt;form action="search3.php" method="post" &gt;
  
  &lt;?php
  
  $mysqli = new mysqli(localhost,user,password,database);
  
  if ($mysqli-&gt;connect_error) {
  die('Error : ('. $mysqli-&gt;connect_errno .') '. $mysqli-&gt;connect_error);
  }
  
  $query = "SELECT DISTINCT Country FROM engravers ORDER BY Country";
  $result = $mysqli-&gt;query($query);
  
  ?&gt;
  &lt;select name="dropdown"&gt;
  &lt;?php
  
  while ($row = $result-&gt;fetch_assoc()) {
      echo "&lt;option value=\"{$row['Country']}\"&gt;";
      echo $row['Country'];
      echo "&lt;/option&gt;";
  }
  $mysqli-&gt;close();
  ?&gt;
  &lt;/select&gt;
  
            &lt;input type="submit"  /&gt;   
            &lt;/form&gt;
  </code></pre>
  
  <p>And this is the results page.It is pretty much copied from the tutorial except in the tutorial $queryparam would have been equal to $_POST['Country']. As that didn't work I've changed it to $_POST['dropdown'] which is the name of the drop down.</p>
  
  <pre><code>$hostname = "localhost";
  $user = "user";
  $password = "password";
  $connection = mysqli_connect($hostname, $user, $password,);
  if(!$connection){
  echo"Could not connect to server";
  };
  mysqli_select_db($connection,'engraved_stamps');
  if(!mysqli_select_db($connection,'engraved_stamps')){
  echo"could not connect to database";
  };
  if(isset($_POST['dropdown']){
  }
  
  $stmt=mysqli_prepare($connection,"SELECT Key, Country, Year, Description, Images FROM engravers   WHERE Country=?");
  $queryParam=$_POST['dropdown'];
  mysqli_stmt_bind_param($stmt,"s",$queryParam);
  mysqli_stmt_bind_result($stmt,$Key,$Country,$Year,$Description,$Images);
  mysqli_stmt_execute($stmt);
  mysqli_stmt_store_result($stmt);
  
  
  $img_url = "http://www.engravedstamps.net/images/"; 
  print '&lt;table border="1" &gt;';
  while($row -&gt;mysqli_stmt_fetch($stmt); 
  {
  
  print '&lt;tr&gt;';
  print '&lt;td&gt;'.$row["Key"].'&lt;/td&gt;';
  print '&lt;td&gt;'.$row["Country"].'&lt;/td&gt;';
  print '&lt;td&gt;'.$row["Year"].'&lt;/td&gt;';
  print '&lt;td&gt;'.$row["Description"].'&lt;/td&gt;';
  
  print  '&lt;td&gt;'.'&lt;img src="'.$img_url.$row['Images'].'" /&gt;'.'&lt;/td&gt;'; 
  print '&lt;/tr&gt;';
  }  
  print '&lt;/table&gt;';
  
  
  $results-&gt;free();
  
  $mysqli-&gt;close();
  </code></pre>
  
  <p>I want to get this working but I also want to know why things work or don't. </p>