Q: Database query to set the value of an input element based on a changeable selection So I have a form for editing an existing article in my database. It looks like this:
<div id="a_EditDiv">
    <h2 id="H-a_Edit">Edit an existing article</h2>
    <form id="F-a_New" action="editarticle.php" method="post" onsubmit="a_Editvalidate();">
        <fieldset>
            <legend>Edit an existing article: </legend>
            <select>
                <option value="1">1</option>
                <option value="2">2</option>
            </select>
            <label for="a_Title_Edit">Article title: </label>
            <br/>
            <input type="text" name="a_Title_Edit" id="a_Title_Edit" value="" />
            <span id="err_a_Title_Edit"></span>
            <br/>
            <label for="a_Details_Edit">Article Details </label>
            <br/>
            <textarea rows="30" cols="" name="a_Details_Edit" id="a_Details_Edit"></textarea>
            <br/>
            <div id="a_Details-rmn_Edit">Remaining characters: 8192/8192</div>
            <span id="err_a_Details_Edit"></span>
            <div>
                <pre>
                    <code>
                        You may use the following html tags: 
                        &lt;a href=""&gt;&lt;/a&gt;
                        &lt;b&gt;&lt;/b&gt;   &lt;i&gt;&lt;/i&gt;   &lt;u&gt;&lt;/u&gt;
                        &lt;object&gt;&lt;/object&gt;
                        Please use:
                        &amp;lt; = &lt;   &amp;gt; = &gt;
                        &amp;euro = &euro;   &amp;dollar; = &dollar;   &amp;pound; = &pound;
                        &amp;amp; = &amp;
                        &amp;copy; = &copy;   &amp;reg; = &reg;
                        Please DO NOT use any other HTML tags.
                    </code>
                </pre>
            </div>
            <label for="a_Author_Edit">Author: </label>
            <br/>
            <input type="text" value="admin" name="a_Author_Edit" id="a_Author_Edit" readonly="readonly" />
            <span id="err_a_Author_Edit">    </span>
            <br/>
            <input class="gray_button" type="button" value="Edit Author" />
            <br/>
            <label for="a_Timestamp">Timestamp: </label>
            <br/>
            <input type="text" value="<?php echo date('d-m-Y') . ' ' . strtoupper(date('h:i:sa'));?>" name="a_Timestamp_Edit" id="a_Timestamp_Edit" readonly="readonly" />
            <br/>
            <input class="gray_button" type="button" value="Edit Timestamp" id="a_Timestamp-enable" />
            <br/><br/>
            <input class="gray_button" type="submit" value="Edit Article" />
            <br/>
            <span id="err_a_Edit"></span>
            <?php 
                if(isset($_GET["article"])){
                    if($_GET["article"] === "success"){
                        echo "Article successfully published.";
                    } else if($_GET["article"] === "failed"){
                        echo "Article was not published.";
                    }
                }
            ?>
        </fieldset>
    </form>
</div>

Yeah... Big code. So when I change the value of the <select> element, I want that the input fields to be filled with the Article's Title, Details, etc. based on the value of the <select> element.
So I need a query to the database to retrieve the values corresponding to <select>'s value and then to set the value of the <input> element's to the corresponding value. I could easily just UPDATE articles WHERE ID = value of select id but I don't wanna do that, I want an interactive way to do it, also by doing this the editor can see what does the post already look like.

A: I have found an answer after a long research. On W3Schools there is a tutorial for PHP, AJAX and MySQL which gave me the perfect solution. It is easily undestandable.
Link: http://www.w3schools.com/php/php_ajax_database.asp
