Anyone familiar w/ ajax/jquery?

can someone tell me what I’m doing wrong as I’m way over my head here. The code navigates as I want but when I key in the apt not only the name appears in the input box but all the HTML also.

include 'prerentget.php';
    <style type="text/css">
<script type="text/javascript" src=""></script>
    <script type="text/javascript">
        function getResults() {
            var search_val = $("#apt").val();
            $.post("test.php", { search_term: search_val }, function(data) {
                if (data.length > 0) {
                    $("#tname")[0].value = data;
<body onload="document.form.apt.focus()">
<form name=form action="testinsert.php" method="post">
<input type="text" size="2" name="apt" id="apt" onkeyup="getResults();
"if(this.value.length==this.size)document.form.time.focus();" />Apt<br />
<input type="text" size="25" id="tname" />Name<br />

<INPUT TYPE="text" size=10 name=datereceived  
onKeyUp="if(this.value.length==this.size)document.form.time.focus();">Date Received<BR>
<INPUT TYPE="text" size=7 name=time>Time Received<BR> 
<INPUT TYPE="text" size=100 name=symptom>Problem<BR> 
<INPUT TYPE="text" size=100 name=action>Action<BR>
<INPUT TYPE="text" size=2 name=compmo MAXLENGTH=2  

<INPUT TYPE="text" size=2 name=compday MAXLENGTH=2  
<INPUT TYPE="text" size=4 name=compyear MAXLENGTH=4  
onKeyUp="if(this.value.length==this.size)document.form.ordno.focus();">Date Completed<br>
<INPUT TYPE="text" size=4 name=ordno>Order# -  If Insp<p> 
<INPUT type=submit value="submit data"/> 

Then I get this error:

Query failed: Column count doesn’t match value count at row 1
I think the size is caused by the result in the name box