title: populating text fields from the sql using dropdown list Jquery
body: <p>Hello there first time doing this, Basically I am rather confused on how to Re-populate text boxes from the database. </p>
  
  <p>My current issue is that basically I have two tables in my database 'USER' and 'STATISTICS'.
  Currently what is working is that my code is looking up the values of 'User_ID' in the 'USER' table and populating the values in the drop down list. </p>
  
  <p>What I want from there is for the text fields to populate corresponding to those values from the database looking up the 'User_ID' E.G 'goal_scored' , 'assist', 'clean_sheets' and etc.</p>
  
  <p>I am pretty baffled I have looked up on various different questions but cannot find what im looking for.</p>
  
  <pre><code>&lt;?php
  $link = mysql_connect("localhost","root","");
  mysql_select_db("f_club",$link);
  $sql = "SELECT * FROM user ";
  $aResult = mysql_query($sql);
  
  ?&gt;
  
  &lt;html&gt;
  &lt;body&gt;
  &lt;title&gt;forms&lt;/title&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/global.css" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="container"&gt;
  
  &lt;form action="update.php" method="post"&gt;
  &lt;h1&gt;Enter User Details&lt;/h1&gt;
  &lt;h2&gt;
  &lt;p&gt; &lt;label for="User_ID"&gt; User ID: &lt;/label&gt; &lt;select id="User_ID" id="User_ID" name="User_ID" &gt;
     &lt;br&gt; &lt;option value=""&gt;Select&lt;/option&gt;&lt;/br&gt;
      &lt;?php
          $sid1 = $_REQUEST['User_ID'];
  
          while($rows=mysql_fetch_array($aResult,MYSQL_ASSOC))
          {
  
          $User_ID = $rows['User_ID'];
          if($sid1 == $id)
          {
          $chkselect = 'selected';
  
          }
          else
          {
          $chkselect ='';
          }
          ?&gt;
          &lt;option value="&lt;?php echo  $id;?&gt;"&lt;?php echo $chkselect;?&gt;&gt;
          &lt;?php echo $User_ID;?&gt;&lt;/option&gt;
          &lt;?php }
          ?&gt;
          I had to put this in because everytime I have text field under the User_ID it goes next to it and cuts it off :S
  
  
           &lt;p&gt;&lt;label for="null"&gt; null: &lt;/label&gt;&lt;input type="text" name="null" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label for="goal_scored"&gt;Goal Scored: &lt;/label&gt;&lt;input type="text" name="Goal_Scored" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label for="assist"&gt;assist: &lt;/label&gt;&lt;input type="text" name="assist"  /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label for="clean_sheets"&gt;clean sheets: &lt;/label&gt;&lt;input type="text" name="clean_sheets" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label for="yellow_card"&gt;yellow card: &lt;/label&gt;&lt;input type="text" name="yellow_card" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;label for="red_card"&gt;red card: &lt;/label&gt;&lt;input type="text" name="red_card" /&gt;&lt;/p&gt;
  
      &lt;p&gt;&lt;input type="submit" name="submit" value="Update" /&gt;&lt;/p&gt;&lt;/h2&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>If anyone can help with understanding how to get to the next stage would be much appreciated thanks x</p>