inserting data
Hello all,
After clicking aruond a simple page i made, I decided 2 try and insert a customer into the customer table that i grab the data from. I figured Im not ready for it. But I decided to go ahead n try to make an insert customer form. When the form is submitted, it directs the user to the action.cfm page. The action.cfm page does the insert query, but if the page is reloaded, then the action page inserts the same record more than once. How do I prevent this from occuring?
please help!
action page code:
<
html>
<head><title>CF Insert Customer Action</title></head>
<body>
<h2>Customer inserted</h2>
<cfif
#Form.Submit# is "Submitted">
<cfquery name="inscustomer" datasource="customers">
Insert into Customers ([First Name],[Last Name],Company,[Job Title],[Business Phone])
values ('#Form.Firstname#','#Form.lastname#','#Form.company#','#Form.jobtitle#','#Form.businessphone#')
</cfquery>
<cfoutput>
<p>Customer #Form.FirstName# #Form.LastName# inserted into database.</p>
<p>#DateFormat(now())# #TimeFormat(Now())#</p>
</cfoutput>
<cfset #Form.Submit#="SubmittedDone">
</cfif>
</body>
</
html>
~