Retrieving database
<p>I'm new to php. I try create a php with drop down menu where when select one of the value from drop down menu(Option), then it will manually retrieve  data from database and display out into text box. But every time i select different value, it only shows the same data from the database. </p>

<pre><code>&lt;?php
&lt;script&gt;
  var myLink = "";
  function hideMe() {
     document.getElementById('btn1').style.visibility='hidden';
     document.getElementById('btn2').style.visibility='hidden';
     document.getElementById('btn3').style.visibility='hidden';
     document.getElementById('2').style.visibility='hidden';
  }
  function setMyAdd() {
     location.href=myLink;
  }

  function checkForChange() {
     document.getElementById('2').style.visibility='visible';
     document.getElementById('btn1').style.visibility='visible';
     document.getElementById('btn2').style.visibility='visible';
     var buttonSelected=test.value;
     if (buttonSelected=="new") {
          myLink = "myPage2.html";
          document.getElementById('btn1').style.visibility='hidden';
          document.getElementById('btn2').style.visibility='visible';
          document.getElementById('btn3').style.visibility='visible';
      } else {
          myLink = "myPage1.html";
          document.getElementById('btn1').style.visibility='visible';
          document.getElementById('btn2').style.visibility='hidden';
          document.getElementById('btn3').style.visibility='visible';
       }
   }
&lt;/script&gt;</code></pre>

<p>And this is the drop down menu</p>

<pre><code>echo "&lt;table&gt;";
echo "&lt;select name=\"test\" id=\"test\" style=\"width:100%; text-align:center\"  value=\"$row[name]\" onChange=\"checkForChange()\" &gt;";
echo "&lt;option id=\"empty\" value=\"new\"&gt;&lt;/option&gt;";
if ($idnum >= 1)
  for ($i = 0; $i &lt; $idnum; $i++) {

      $smart_name = mysql_result($smartfilter_list, $i, "name");`
      echo "&lt;/select&gt;";
      echo "&lt;/td&gt;";
      echo "&lt;option value=\"\smart_name \"&gt;$smart_name&lt;/option&gt;";`
  }
}
?&gt;</code></pre>

<p>This is the text box where when if i select one of the value from the drop down menu then it will retrieve data from database and display out inside the text box. And all is in one form. Izzit there is the way to do it without using 2 pages(GET). </p>

<pre><code>&lt;?php

$select_sql = "SELECT * FROM $event_db_table WHERE name = '$smart_name'";

        $smartfilter_list = mysql_query($select_sql);
        $idnum = mysql_num_rows($smartfilter_list);
        $row = mysql_fetch_array($smartfilter_list);


    echo "&lt;tr&gt;";
        echo "&lt;td&gt;Name : &lt;/td&gt;";
        echo "&lt;td&gt;&lt;input style='text-align:center' type = 'text' name = \"name\"  value=\"$row[name]\" required&gt;$smart_name&lt;/input&gt;&lt;/td&gt;";
    echo "&lt;/tr&gt;";
?&gt;</code></pre>
