first of all get outta the habit of using the dreamweaver insert behavior
then make a snippet of this and use it as a template

on the page with the form remove the dw behavior then add a page named process.cfm or whatever and point the form to that page
then on the processing page add the following code (then add whatever u want after the code to send them to another page or display a message or include a page

<!--- make sure form was submitted, if it wasnt it will display this error --->
<cfif  NOT isdefined("form.submit")>
<h2>Sorry there has been an error, please try again</h2>
<p><a href="" back</a></p>
<cfabort>
</cfif>


<!--- set form variables and trim them before inserting into db --->
<cfset HFUsername = #trim(form.HFUsername)#>
<cfset HFCodeNo = #trim(form.HFCodeNo)#>
<cfset HFDIN = #trim(form.HFDIN)#>
<cfset HFBrandName = #trim(form.HFBrandName)#>
<cfset HFManufacturer = #trim(form.HFManufacturer)#>
<cfset HFGenericName = #trim(form.HFGenericName)#>
<cfset HFSize = #trim(form.HFSize)#>
<cfset HFPrice = #trim(form.HFPrice)#>
<cfset HFQty = #trim(form.HFQty)#>
<cfset HFExtension = #trim(form.HFExtension)#>

<!--- insert the  contents of the form into the db --->
<cfif isdefined ("form.submit")>
<cfquery name="rsOrders " datasource="MontPharmaData">
INSERT INTO Orders  
(HFUsername, HFCodeNo, HFDIN, HFBrandName, HFManufacturer, HFGenericName, HFSize, HFPrice, HFExtension)
VALUES
('#HFUsername#', '#HFCodeNo#', '#HFDIN#', '#HFBrandName#', '#HFManufacturer#', '#HFGenericName#', '#HFSize#', '#HFPrice#',#HFQty#, '#HFExtension#')
</cfquery>
</cfif>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to