title: Echo value when select an option - PHP Only
body: <p>I am just starting to learn php and I have some problem with my little project.
  I create a DB that contain "members" table with "member_id" and "member_name" calumn.
  I create a select box that is populated with members name. When I select a name and I click to submit button, I want to echo the member_id. How can I do that without javascript/ajax. </p>
  
  <p>PS. I want to stay on the current page after submiting.</p>
  
  <p>Thank you very much.</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;h2&gt;Select&lt;/h2&gt;
  &lt;table&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;
          &lt;form method="post" action="&lt;?=($_SERVER['PHP_SELF'])?&gt;"&gt;
  
            &lt;table&gt;
            &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;Nume&lt;/th&gt;
                  &lt;th&gt;Id&lt;/th&gt;
              &lt;/tr&gt;
            &lt;/thead&gt;
            &lt;tr&gt;
              &lt;td&gt;&lt;select name="numeselect"&gt;
                &lt;?php
                  $numeselect=$_POST ["numeselect"];
                  $host="localhost";
                  $user="***";
                  $password="***";
                  $db_name="***";
  
                  $con=mysqli_connect($host,$user,$password,$db_name);
                  if(mysqli_connect_errno($con)){
                      echo "Eroare la coenxiune:" . mysqli_error();   
                  }
  
                  $selectare_nume = mysqli_query($con,"SELECT nume_membru, id_membru FROM membri");
  
                  while($nume_selectat = mysqli_fetch_array($selectare_nume)){
                      echo '&lt;option value="'.$nume_selectat['nume_membru'].'"&gt;'.$nume_selectat['nume_membru'].'&lt;/option&gt;';
                  }
                  echo '&lt;/select&gt;&lt;/td&gt;';
                  while($id_selectat = mysqli_fetch_array($selectare_nume)){
                  echo '&lt;td&gt;'.$id_selectat['$id_membru'].'&lt;/td&gt;';
                  }
                  echo '&lt;/tr&gt;&lt;/table&gt;';
  
                  ?&gt;
                &lt;input type="submit" value="show id"&gt;
          &lt;/form&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>