codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  MySQL DB insert ASP problem  crmpicco at 16:11 on Tuesday, March 08, 2005
 

I have a asp page called '/forum/reg_confirm.html'

The problem i am having is that everytime the page is refreshed the MySQL DB is updated (i.e. my insert statement is run).

How can i only allow this once?

Code:

<% ' Last Edit: CRM_08mar05 %>
<!-- #Include file="/forum/connection.html"-->
<%
agencyid = Session("agencyid")
forename = request.form("forename")
surname = request.form("surname")
comp_name = request.form("comp_name")
position = request.form("position")
email = request.form("email")

agency_id = request.form("agency_id")
agent_id = request.form("agent_id")
user_name = request.form("user_name")
pass_word = request.Form("pass_word")

response.write "agency_id = " & agency_id & "<br>"
response.write "agent_id = " & agent_id & "<br>"
response.write "user_name = " & user_name & "<br>"
response.write "pass_word = " & pass_word & "<br>"

'response.write "Agency ID = " & agencyid & "<br>"
'response.write "Forename = " & forename & "<br>"
'response.write "Surname = " & surname & "<br>"
'response.write "Comp Name = " & comp_name & "<br>"
'response.write "Position = " & position & "<br>"
'response.write "Email = " & email & "<br>"
function fixquotes(str)
fixquotes=Replace(str,"'","")
end function

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Volaro: Terms & Conditions</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<%
set rsreg=con.execute("insert into authusers_reg (agencyid,forename,surname,company_name,email,position) values ('"& agencyid &"','"& fixquotes(forename) &"', '"& fixquotes(surname) &"', '"& comp_name &"', '"& email &"', '"& fixquotes(position) &"')")
'response.write "" &("insert into authusers_reg (agencyid,forename,surname,company_name,email,position) values ('"& agencyid &"','"& forename &"', '"& surname &"', '"& comp_name &"', '"& email &"', '"& position &"')")& "<br>"
%>
<body bgcolor="#f5f5f5">
<form name="form">
<table width="550" bgcolor="#ECECEC" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="16" bgcolor="#ECECEC"><img src="/forum/images/top_lefbb.gif" width="16" height="16"></td>
<td height="16" bgcolor="#ECECEC" background="/forum/images/top_midbb.gif"><img src="/forum/images/top_midbb.gif" width="16" height="16"></td>
<td width="24" bgcolor="#ECECEC"><img src="/forum/images/top_rigbb.gif" width="24" height="16"></td>
</tr>
<tr>
<td width="16" background="/forum/images/cen_lef.gif"><img src="/forum/images/cen_lef.gif" width="16" height="11"></td>
<td><Table width="100%" border="1" bordercolor="#666666" align="center" cellpadding="0" cellspacing="1">
<tr bgcolor="#006699" bordercolor="#000000" border="1"><Td width="100%" align="Left"><span class="style1"><font face="verdana" size=2 color="#FFFFFF"><strong>Registration Confirmation</strong></font></span></td>
</tr>
<%
'forename = this.form.forename.value
'response.write "Forename = " & forename & "<br>"
%>
<tr>
<td height="25" align="center" bordercolor="#ececec" border="0">
<font face="verdana" size="2">Congratulations <%=forename & " " & surname %>,</font>
</td>
<!-- <a href="/forum/linktest.pdf">test</a>-->
</tr>
<tr><td height="25" align="center" bordercolor="#ececec" border="0">
<font face="verdana" size="2">You have successfully registered</font>
</td>
</tr>
<tr bgcolor="#ececec" bordercolor="#ececec">
<td bgcolor="#ececec" bordercolor="#ececec" align="center">
<input type="button" name="finish" id="finish" value="Finish" onmouseover="style.cursor='hand'" onClick="location.href='/forum/logincheck_agencyid__lt_agency_id_gt__ampagentid__ltagent_id__gt__ampusername__lt_user_name_gt__amppassword__lt_pass_word_gt_.html'">
</td></tr>
<%
'finish = this.form.finish.value
'response.write "Finish = " & finish & "<br>"

'if request.form("finish") = "finish" then
'response.redirect "/mackenzie/login.asp"
'end if
%>
</table>
</td>
<td width="24" background="/forum/images/cen_rigBB.gif" bgcolor="#ECECEC"><img src="/forum/images/cen_rigBB.gif" width="24" height="11"></td>
</tr>
<tr bgcolor="#ECECEC">
<td width="16" height="16"><img src="/forum/images/bot_lefbb.gif" width="16" height="16"></td>
<td height="16" bgcolor="#ECECEC" background="/forum/images/bot_midbb.gif"><img src="/forum/images/bot_midbb.gif" width="16" height="16"></td>
<td width="24" height="16" bgcolor="#ECECEC"><img src="/forum/images/bot_rigbb.gif" width="24" height="16"></td>
</tr>
</table>
</form>
</body>
</html>









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Help: Trouble with z-Index and SELECT lists
•  Help with
•  Re: C# and EXCEL question saving a file saving the the first column as read only
•  Iexplore -
•  Iframe and Div Layer Scrollbar Problem
•  Left margin increases as page fills.....
•  Re: Parse error that is slowly driving me insane
•  simple javascript/dhtml drop-down menu
•  notify an object that the user interface has changed one of its properties


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005