title: get value in textbox from database according to seleceted dropdown item in php
body: <p>So I've to change text box data according to option selected in dropdown. I want that text box data to be fetched from database.</p>
  
  <p>For <strong>eg:</strong> If I choose Airmail then current frank value of airmail should be displayed in text box from database. </p>
  
  <p>Here is my code</p>
  
  <pre><code>&lt;div&gt;
      &lt;form action="alertfrank.php" method="POST" class="boxin" id="dropdown"&gt;
          &lt;select name="type_post" required id="type_post" &gt;
              &lt;option value="Select Post Type" selected&gt;Select Post Type&lt;/option&gt;
              &lt;option value="Airmail" &gt;Airmail&lt;/option&gt;
              &lt;option value="Airmail AD"&gt;Airmail AD&lt;/option&gt;
              &lt;option value="Airmail Speed Post"&gt;Airmail Speed Post&lt;/option&gt;
              &lt;option value="Speed Post"&gt;Speed Post&lt;/option&gt;
              &lt;option value="Book Post"&gt;Book Post&lt;/option&gt;
              &lt;option value="Ordinary Post"&gt;Ordinary Post&lt;/option&gt;
              &lt;option value="Registered Post"&gt;Registered Post&lt;/option&gt;
              &lt;option value="Registered AD"&gt;Registered AD&lt;/option&gt;
              &lt;option value="Registered Parcel"&gt;Registered Parcel&lt;/option&gt;
              &lt;option value="Parcel"&gt;Parcel&lt;/option&gt;
              &lt;option value="Courier"&gt;Courier&lt;/option&gt;
          &lt;/select&gt;
          &lt;br/&gt;
          &lt;br/&gt;
          Current Frank Value &lt;?php echo '&lt;input type="number" name="value_frank" value=""&gt;'; ?&gt; &lt;br/&gt;
          &lt;br/&gt;
          New Frank Value
          &lt;input type="number" name="new_frank" placeholder="New Frank value"/&gt;
          &lt;br/&gt;
          &lt;br/&gt;
          &lt;input type="submit" name="submit" value="Change Value" id="sub"/&gt;
          &lt;br/&gt;
          &lt;br/&gt;
          &lt;br/&gt;
          &lt;br/&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  &lt;?php
  if (null !== (filter_input(INPUT_POST, 'submit'))) {
      mysql_connect("localhost", "root", "") or die(mysql_error());
      mysql_select_db("disp") or die(mysql_error());
      $type_post = (filter_input(INPUT_POST, 'type_post'));
      $_SESSION['type_post'] = $type_post;
      $q = mysql_query("select value_frank from frank where type_post='" . $_SESSION['type_post'] . "'") or die(mysql_error());
      $value_frank = mysql_fetch_row($q);
      $_SESSION['value_frank'] = $value_frank;
  }
  ?&gt;
  </code></pre>
  
  <p>I want current frank value to be displayed in value_frank feild..and before submit. </p>