DuncanKing
Programmer
I have created a web service to enter data into an access db with the following cfc page.
I'm calling this with a cfm page and a cfinvoke tag and URL I get the "Congrats Inserted!!" message returned when I submit the form but no data goes into the access db. Any ideas where the problem might be?
Thanks DK
<!---start addBooking.cfc page--->
<cfcomponent>
<cffunction name="testFunct" access="remote" returntype="string">
<cfargument name="x" type="struct" required="true">
<cfquery datasource="cars_autoselect_ca" >
Insert Into bbBooking (name, address, tel, description, accommodation, price, availability)
Values ('#name#', '#address#', '#tel#' '#description#' '#accommodation#', '#price#', '#availability#' )
</cfquery>
<cfreturn x.name>
</cffunction>
</cfcomponent>
<!---end addBooking.cfc page--->
<!---start of addBooking.cfm page that calls the cfc--->
<cfif IsDefined("myvar")>
<cfscript>
myvar = StructNew();
myvar["name"] = URL.name;
myvar["address"] = URL.address;
myvar["tel"] = URL.tel;
myvar["description"] = URL.description;
myvar["accommodation"] = URL.accommodation;
myvar["price"] = URL.price;
myvar["availability"] = URL.availability;
</cfscript>
<cfinvoke
webservice=" method="testFunct"
returnvariable="aString" >
<cfinvokeargument name="x" value="#myvar#" />
</cfinvoke>
</cfif>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Sean Test</title>
</head>
<body>
<cfif IsDefined("URL.name")> Congrats Inserted!! </cfif>
<form action="addBooking.cfm" method="get" >
<table width="90%" border="1">
<tr>
<td>name</td>
<td><input name= "name" type="text" id="name"></td>
</tr>
<tr>
<td>add</td>
<td><input type="text" name= "address" id="address" value="enter you address"></td>
</tr>
<tr>
<td>tel</td>
<td><input type="text" name="tel" id="tel"></td>
</tr>
<tr>
<td>description</td>
<td><input name="description" type="text" id="description"></td>
</tr>
<tr>
<td>accommodation</td>
<td><input name="accommodation" type="text" id="accommodation"></td>
</tr>
<tr>
<td>price</td>
<td><input name="price" type="text" id="price"></td>
</tr>
<tr>
<td>availability</td>
<td><input name="availability" type="text" id="availability"></td>
</tr>
</table>
<p>
<input type="submit" value="Submit" name="form1" >
</p>
</form>
</body>
</html>
<!---end addBooking.cfm page--->
I'm calling this with a cfm page and a cfinvoke tag and URL I get the "Congrats Inserted!!" message returned when I submit the form but no data goes into the access db. Any ideas where the problem might be?
Thanks DK
<!---start addBooking.cfc page--->
<cfcomponent>
<cffunction name="testFunct" access="remote" returntype="string">
<cfargument name="x" type="struct" required="true">
<cfquery datasource="cars_autoselect_ca" >
Insert Into bbBooking (name, address, tel, description, accommodation, price, availability)
Values ('#name#', '#address#', '#tel#' '#description#' '#accommodation#', '#price#', '#availability#' )
</cfquery>
<cfreturn x.name>
</cffunction>
</cfcomponent>
<!---end addBooking.cfc page--->
<!---start of addBooking.cfm page that calls the cfc--->
<cfif IsDefined("myvar")>
<cfscript>
myvar = StructNew();
myvar["name"] = URL.name;
myvar["address"] = URL.address;
myvar["tel"] = URL.tel;
myvar["description"] = URL.description;
myvar["accommodation"] = URL.accommodation;
myvar["price"] = URL.price;
myvar["availability"] = URL.availability;
</cfscript>
<cfinvoke
webservice=" method="testFunct"
returnvariable="aString" >
<cfinvokeargument name="x" value="#myvar#" />
</cfinvoke>
</cfif>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Sean Test</title>
</head>
<body>
<cfif IsDefined("URL.name")> Congrats Inserted!! </cfif>
<form action="addBooking.cfm" method="get" >
<table width="90%" border="1">
<tr>
<td>name</td>
<td><input name= "name" type="text" id="name"></td>
</tr>
<tr>
<td>add</td>
<td><input type="text" name= "address" id="address" value="enter you address"></td>
</tr>
<tr>
<td>tel</td>
<td><input type="text" name="tel" id="tel"></td>
</tr>
<tr>
<td>description</td>
<td><input name="description" type="text" id="description"></td>
</tr>
<tr>
<td>accommodation</td>
<td><input name="accommodation" type="text" id="accommodation"></td>
</tr>
<tr>
<td>price</td>
<td><input name="price" type="text" id="price"></td>
</tr>
<tr>
<td>availability</td>
<td><input name="availability" type="text" id="availability"></td>
</tr>
</table>
<p>
<input type="submit" value="Submit" name="form1" >
</p>
</form>
</body>
</html>
<!---end addBooking.cfm page--->