title: How to change text box values based on dropdown selection from database
body: <p>I have successfully been able to retrieve values from a MySQL database into a dropdown list using the code below:</p>
  
  <pre><code>    &lt;select name= "patientname" id="pname" class="form-control2" required&gt;
      &lt;option selected="selected" value=""&gt; Select Patient&lt;/option&gt;
       &lt;?php
        $sql = "SELECT * FROM patient_details";
        $result=mysqli_query($conn,$sql);
        while($row=mysqli_fetch_array($result))
        echo "&lt;option value='" . $row['name'] . "'&gt;" . $row['name'] . "&lt;/option&gt;";
        ?&gt;
      &lt;/select&gt;
  </code></pre>
  
  <p>The issue I'm currently experiencing is how to display a value on the textfield below based on the value of the dropdown selection. Putting into mind, the value to be displayed is also in the database. The text field is shown below:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
    Last Check-up Date
    &lt;input type="text" name="Last Checkup" id="lcheck" class="form-control2" &gt;"; 
  &lt;/div&gt;
  </code></pre>
  
  <p>Any code to change the value dynamically once the dropdown value is selected?</p>