I am trying to create a script that updates an Access database each time a person enters data into a text field by using the onblur function. Here is my code:
<html>
<head>
</head>
<body>
<script language="javascript">
function test(var) {
<cfquery datasource="help" name="A">
update employees
set name='var'
where id=1
</cfquery>;
window.alert('This field has been saved');
}
</script>
<input type="text" name="system" value="Carlos" onblur="test('Carlos')">
</body>
</html>
Instead of entering Carlos into the database, it enters var. What am I doing wrong.
<html>
<head>
</head>
<body>
<script language="javascript">
function test(var) {
<cfquery datasource="help" name="A">
update employees
set name='var'
where id=1
</cfquery>;
window.alert('This field has been saved');
}
</script>
<input type="text" name="system" value="Carlos" onblur="test('Carlos')">
</body>
</html>
Instead of entering Carlos into the database, it enters var. What am I doing wrong.