title: PHP - Variable inside <form action=" "> attribute as part of url for get method
body: <p>Trying to pass a php variable inside the action attribute for html forms as part of the get method of passing variables through url based on the option that was selected. </p>
  
  <pre><code> &lt;?php 
   ...
   $sql = "SELECT staffID, staffName
   FROM staff";
  
  $results = mysqli_query($conn, $sql)
  or die ('Problem with query' . mysqli_error($conn));
  ?&gt;
      &lt;form action = "task7.php?" method = "get"&gt; 
          &lt;select&gt;
          &lt;?php 
          while($row = mysqli_fetch_array($results))
          {
              $staffID = $row["staffID"]; 
              $staffName = $row["staffName"];
          ?&gt;
          &lt;option value = "&lt;?php echo $staffID ?&gt;"&gt; &lt;?php echo $staffName ?&gt; &lt;/option&gt;
          &lt;?php 
          } 
          ?&gt; 
          &lt;/select&gt;
  
          &lt;br&gt; &lt;br&gt; 
          &lt;input type = "submit" value = "Submit"&gt; 
          &lt;input type = "reset" value = "Reset"&gt;  
  
      &lt;/form&gt; 
  </code></pre>
  
  <p>In this particular case I'm trying to pass the staffID variable as part of the url. Something like this <code>tast7.php?staffID=12345</code></p>