I’m trying to acquire names from a database table and insert them into boxes in a form which will in turn do an insertion into another database table. Thus far I get them into the input box but when I click the submit, I get an
error:
Query failed: Column count doesn't match value count at row 1.
I know that the table jives with the code and having never used Ajax I just don’t know.
<?php
include 'prerentget.php';
?>
<html>
<head>
<style type="text/css">
</style>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/
1.4.2/jquery.min.js"></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;
}
})
}
</script>
<script type="text/javascript">
window.google_analytics_uacct =
"UA-256751-2";
</script>
</head>
<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.ti
me.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)docum
ent.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
onKeyUp="if(this.value.length==this.size)docum
ent.form.compday.focus();">
<INPUT TYPE="text" size=2 name=compday
MAXLENGTH=2
onKeyUp="if(this.value.length==this.size)docum
ent.form.compyear.focus();">
<INPUT TYPE="text" size=4 name=compyear
MAXLENGTH=4
onKeyUp="if(this.value.length==this.size)docum
ent.form.ordno.focus();">Date Completed<br>
<INPUT TYPE="text" size=4
name=ordno>Order# - If Insp<p>
<p>
<INPUT type=submit value="submit data"/>
<BR></form>
<script type="text/javascript"><!--
var gaJsHost = (("https:" ==
document.location.protocol) ? "https://ssl." :
"http://www.");
document.write(unescape("%3Cscript src='" +
gaJsHost + "google-analytics.com/ga.js'
type='text/javascript'%3E%3C/script%3E"));
//-->
</script>
<script type="text/javascript">
try {
var pageTracker =
_gat._getTracker("UA-256751-2");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body></html>