title: Inserting SQL data into HTML textarea
body: <p>I've been reading lots of questions at stackoverflow that have made my life easier, first time I ask something though.</p>
  
  <p>Here is my problem. I need to be able to insert different values from my SQL database into a selected &lt; textarea > field, depending on what option is selected in a &lt; select > input on the same form.</p>
  
  <p>The basic idea is that I want to edit news from the database, edit title and body. To do that, I want to show what (title / body) data contains my db to the user, by getting them from my SQL db. User may have multiple entries in the database, so when I select one entry at the &lt; select > combobox, I'd like to change the  contents to those from the selected entry from the db.</p>
  
  <p>Its a simple idea difficult to express due to my poor English...</p>
  
  <p>HTML form would be more or less as follows:</p>
  
  <pre><code>&lt;form action="edit.php" method="post"&gt;
      &lt;select name="id"&gt;
         &lt;option value="1"&gt;Option 1&lt;/option&gt;
         &lt;option value="2"&gt;Option 2&lt;/option&gt;
      &lt;/select&gt;
      &lt;textarea name="newsBody"&gt;&lt;/textarea&gt;
      &lt;input name="submit" type="submit" value="Edit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>SQL database structure goes more or less as follows:</p>
  
  <p>DB name: database</p>
  
  <p>DB table: news (fields id, body, title, author, timestamp)</p>
  
  <p>I'd like to be able to select news from my &lt; select > getting their 'id' / 'option value', then get from the DB the corrrect value, and show it in the corresponding &lt; textarea >.</p>
  
  <p>I'm new into website coding, and do it just as a hobby, so my knowledge in PHP, MySQL is very basic. I dont provide any PHP code or options, simply because I have no idea how to resolve it... I can understand sql, php syntax though.</p>
  
  <p>I thought using &lt; select > event 'onchange' and javascript, but couldn't make it work... Neither could I using jQuery / ajax, probably because the lack of useful examples!!</p>
  
  <p>Hope that someone understands and can provide a solution!</p>
  
  <p>Many thanks in advance!</p>