i have one dropdown list which has data for "subjects" loaded from database. when i clicked on one subject what it should do is load related "subject_id" value inside textbox which is just below dropdown list option. i dont know how to bring value from getbook.php and show in book_ID input text.
show_bookid(str) {
    var xmlhttp;
    if (str.length == 0) {
        document.getElementById("bookid").innerHTML = "";
        return;
    }
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    } else {
        strong text
        xmlhttp = new ActiveXOjbject("Microsoft.XMLHttpRequest");
    }
    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            document.getElementById("bookid").innerHTML = xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET", "getbook.php?q=" + str, true);
    xmlhttp.send();
}
getbook.php
<?php
<?php
$b = $_GET['q'];
include('includes/security.php');
include('includes/dbconnect.php');
$database = new MySQLDatabase();
$sql = "select * from tbl_bkcat where book_id='" . $b . "'";
$result = mysql_query($sql);
?>
?>
below is the File where i need to bring value
<form name="bookadd" action="" class="jNice" method="post">
    <p>
        <label>Subject</label>
        <select name="subject" onChange="show_bookid(this.value);">
            <?php while($sel_rows=mysql_fetch_array($subresult)) { ?>
            <option value="<?php echo $sel_rows['book_id'];?>">
                <?php echo $sel_rows[ 'subject']?>
            </option>
            <?php } ?>
        </select>
    </p>
    <p>
        <label>Book_Id</label>
        <input type="text" id="bookid" class="text-small" />//where i need to load subject id</p>