[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.1

ASP adding multiple records on insert

Asked by elliottbenzle in Active Server Pages (ASP)

My page is supposed to insert the names of new senators into a database.It works pretty well but for some reason when insert a record the page also inserts a second blank record. The insert page is here:

http://www.palauoek.net/senate/_private/senatorsadd.asp

and the display page to see the added records is here (you can either scroll down or check out the drop down menu under senators):

http://www.palauoek.net/senate/dbtest6.asp

Could someone please take a look at my code below and tell me what might be causing this extra added record? I'm guessing that the page might be reloading and running the upload script twice once without any form data. Thanks for any help.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/con_str_two_up.asp" -->
 
<%
	Set Upload = Server.CreateObject("Persits.Upload.1")
 
	Upload.OverwriteFiles = False
	On Error Resume Next
 
	Upload.SetMaxSize 1048576	' Limit files to 1MB
	Count = Upload.Save (server.MapPath("FAQpics/"))
	
	Dim firstname, lastname, addressvar, cityvar, countryvar, zipvar, imagevar, emailvar, editor1
	
	firstname = Upload.form("firstname")
	lastname = Upload.form("lastname")
	addressvar = Upload.form("addressvar")
	cityvar = Upload.form("cityvar")
	countryvar = Upload.form("countryvar")
	zipvar = Upload.form("zipvar")
	imagevar = Upload.form("imagevar")
	emailvar = Upload.form("emailvar")
	editor1 = Upload.form("editor1")
	
	firstname = Replace(firstname, "'", "''")
	lastname = Replace(lastname, "'", "''")
	addressvar = Replace(addressvar, "'", "''")
	cityvar = Replace(cityvar, "'", "''")
	countryvar = Replace(countryvar, "'", "''")
	zipvar = Replace(zipvar, "'", "''")
	imagevar = Replace(imagevar, "'", "''")
	emailvar = Replace(emailvar, "'", "''")
	editor1 = Replace(editor1, "'", "''")
 
 
	set cadddetail = Server.CreateObject("ADODB.Command")
	cadddetail.ActiveConnection = objConn
	cadddetail.CommandText = "INSERT INTO senators (lastname, fisrtname, bio, address, city, country, zip)  VALUES ( '" & lastname & "', '" & firstname & "', '" & editor1 & "', '" & addressvar & "', '" & cityvar & "', '" & countryvar & "', '" & zipvar & "') "
	cadddetail.CommandType = 1
	cadddetail.CommandTimeout = 0
	cadddetail.Prepared = true
	cadddetail.Execute()
	
%>
<html>
<!-- Site created by Kukau.com aka Olekoi Palau -->
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="keywords" content="Palau, Belau, Republic of Palau, Palau Government, Palau OEK,  Palau Executive, Palau Official Web Site, Legislative, Palau News, Palau Links, Palau Investing,  Palau Regulations, Senate, House of Delegates, Boards, Joint Resolutions, Resolutions, Senate Bill,  Commissions, Palau Senate, Olbiil Era Kelulau">
<meta name="description" content="The official website of the Government of the Republic of Palau, Olbiil Era Kelulau, Senate">
<title>ROP Olbiil Era Kelulau Senate | Senator Seid Profile</title>
<SCRIPT language=JavaScript>
<!--
function click() {
if (event.button==2) {
alert('Please contact the Site Administrator regarding website content.  Sulang!');
}
}
document.onmousedown=click
// --> 
</SCRIPT>
<style fprolloverstyle>
A:hover {color: #000099}
.style1 {
	font-size: 14px;
	font-weight: bold;
	color: #0F1291;
	font-family: Arial, Helvetica, sans-serif;
}
.style2 {
	color: #01015B;
	font-weight: bold;
	font-size: 16px;
}
</style>
</head>
 
<body style="font-family: Arial; font-size: 10pt; " topmargin="0" link="#000000" vlink="#000000" alink="#000000" bgcolor="#666666" bgproperties="fixed" background="../images/oekbackground.jpg" bottommargin="0">
 
<div align="center">
  <table border="0" width="800" style="border-width:0px; font-family:Arial; font-size:10pt; " cellspacing="0" cellpadding="0" bordercolor="#C0C0C0" bgcolor="#FFFFFF">
    <tr>
      <td style="border-style:none; border-width:medium; " height="21" bordercolor="#FFFFFF" bgcolor="#000040" background="../images/headers/headeroekborder2.jpg">
      <p align="left">&nbsp;</td>
    </tr>
    <tr>
      <td bordercolor="#FFFFFF" valign="top" style="border-style:none; border-width:medium; padding:0; ">
      <p align="center">
      <object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="800" height="125">
        <param name="movie" value="../images/headersub.swf">
        <param name="quality" value="High">
        <embed src="../images/headersub.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="800" height="125" quality="High"></object>
      </td>
    </tr>
    <tr>
      <td bgcolor="#000040" bordercolor="#FFFFFF" background="../images/headers/headeroekborder2.jpg" height="20" style="border-top-style: none; border-top-width: medium">&nbsp;
      </td>
    </tr>
    <tr>
      <td bgcolor="#DCDCBA" bordercolor="#FFFFFF" height="20" nowrap>
<!--webbot bot="Include" U-Include="MainMenu.htm" TAG="BODY" startspan -->
<script language="JavaScript" type="text/javascript" src="../menu2_scr.js">
</script>
  <div align="center">
  <table  id="m1mainSXMenu2" cellspacing="0" cellpadding="4" border="0" style="font-family: Arial; font-size: 8pt" >
    <tr align="center">
      <td onMouseOver="chgBg(m1,'m1tlm0',3);exM(m1,'m1mn1','m1tlm0',event)" onMouseOut="chgBg(m1,'m1tlm0',0);coM(m1,'m1mn1')" id="m1tlm0" class="m1mit" bgcolor="#DCDCBA" nowrap>
      <font face="Verdana">
      <a id="m1tlm0a" class="m1CL0">
      <span style="font-size: 8pt">WELCOME</span></a></font><span style="font-size: 8pt"></td>
      <td onMouseOver="chgBg(m1,'m1tlm1',3);exM(m1,'m1mn2','m1tlm1',event)" onMouseOut="chgBg(m1,'m1tlm1',0);coM(m1,'m1mn2')" id="m1tlm1" class="m1mit" bgcolor="#DCDCBA" nowrap>
      <font face="Verdana">
      <a id="m1tlm1a" class="m1CL0">
      SENATORS</a></font></td>
      <td onMouseOver="chgBg(m1,'m1tlm2',3);exM(m1,'none','',event)" onMouseOut="chgBg(m1,'m1tlm2',0,1)" id="m1tlm2" class="m1mit" bgcolor="#DCDCBA" nowrap>
      <font face="Verdana">
      <a id="m1tlm2a" class="m1CL0" href="http://senate.palauoek.net/committees.asp" >
      COMMITTEES</a></font></td>
      <td onMouseOver="chgBg(m1,'m1tlm3',3);exM(m1,'m1mn3','m1tlm3',event)" onMouseOut="chgBg(m1,'m1tlm3',0);coM(m1,'m1mn3')" id="m1tlm3" class="m1mit" bgcolor="#DCDCBA" nowrap>
      <font face="Verdana">
      <a id="m1tlm3a" class="m1CL0">
      LEGISLATION</a></font></td>
      <td onMouseOver="chgBg(m1,'m1tlm4',3);exM(m1,'none','',event)" onMouseOut="chgBg(m1,'m1tlm4',0,1)" id="m1tlm4" class="m1mit" bgcolor="#DCDCBA" nowrap>
      <font face="Verdana">
      <a id="m1tlm4a" class="m1CL0" href="http://senate.palauoek.net/news.asp" >
      NEWS</a></font></td>
      <td onMouseOver="chgBg(m1,'m1tlm5',3);exM(m1,'m1mn4','m1tlm5',event)" onMouseOut="chgBg(m1,'m1tlm5',0);coM(m1,'m1mn4')" id="m1tlm5" class="m1mit" bgcolor="#DCDCBA" nowrap>
      <font face="Verdana">
      <a id="m1tlm5a" class="m1CL0">
      ABOUT US</a></font></td>
      <td onMouseOver="chgBg(m1,'m1tlm6',3);exM(m1,'none','',event)" onMouseOut="chgBg(m1,'m1tlm6',0,1)" id="m1tlm6" class="m1mit" bgcolor="#DCDCBA" nowrap>
      <font face="Verdana">
      <a id="m1tlm6a" class="m1CL0" href="http://www.palauoek.net/forum/photos/">PHOTOS</a></font></td>
      <td onMouseOver="chgBg(m1,'m1tlm7',3);exM(m1,'none','',event)" onMouseOut="chgBg(m1,'m1tlm7',0,1)" id="m1tlm7" class="m1mit" bgcolor="#DCDCBA" nowrap>
      <font face="Verdana">
      <a id="m1tlm7a" class="m1CL0" href="http://senate.palauoek.net/links.asp" >
      LINKS</a></font></td>
      <td onMouseOver="chgBg(m1,'m1tlm8',3);exM(m1,'none','',event)" onMouseOut="chgBg(m1,'m1tlm8',0,1)" id="m1tlm8" class="m1mit" bgcolor="#DCDCBA" nowrap>
      <font face="Verdana">
      <a id="m1tlm8a" class="m1CL0" href="http://senate.palauoek.net/contactus.asp" >
      CONTACT US</a></font></td>
      <td onMouseOver="chgBg(m1,'m1tlm9',3);exM(m1,'none','',event)" onMouseOut="chgBg(m1,'m1tlm9',0,1)" id="m1tlm9" class="m1mit" bgcolor="#DCDCBA" nowrap>
      </span>
      <font face="Verdana">
      <a id="m1tlm9a" class="m1CL0" href="http://senate.palauoek.net/sitemap.asp" >
      <span style="font-size: 8pt">SITE MAP</span></a></font></td>
    </tr>
  </table>
</div>
<!--webbot bot="Include" i-checksum="31208" endspan --></tr>
    <tr>
      <td bgcolor="#FFFFFF" bordercolor="#FFFFFF" style="padding-top: 0; padding-bottom: 0">
      <p align="center"><span style="font-size: 4pt">&nbsp;</span></td>
    </tr>
    <tr>
      <td style="font-family:Arial; font-size:11pt; border-top-width:medium; padding-left:60px; padding-right:60px; padding-top:60px; padding-bottom:80px" bordercolor="#FFFFFF" align="left" valign="top" height="600">
 
<p align="center" style="margin-bottom: 40px">
      <img border="0" src="../images/headers/HeaderSenatorProfile.gif" alt="Senator's Profile"></p>
<font face="Tahoma">
 
 
    
    <table border="0" style="float: right; padding-left: 20px; font-family:Arial; font-size:8pt" cellspacing="6">
  <tr>
    <td>
    <p align="center">
      <span style="font-size: 11pt">
      
      <img border="0" src="<%=(rssenator.Fields.Item("imageloc").Value)%>" width="150" height="200" style="border-style: double; border-width: 4px" alt="Photo - Mr. Alan R. Seid, Senate Floor Leader"><br clear="all">
      <br>
      <span class="style1"><%=(rssenator.Fields.Item("fisrtname").Value)%>&nbsp;<%=(rssenator.Fields.Item("lastname").Value)%></span></span></td>
  </tr>
  </font>
<font size="1" style="font-size: 8pt">
  </table>
</font>
<p>
<img border="0" src="../images/bulletudoud.jpg" width="25" height="25" align="top"><span class="style2">The Honorable <%=(rssenator.Fields.Item("fisrtname").Value)%>&nbsp;<%=(rssenator.Fields.Item("lastname").Value)%></span></p>
<p><%=(rssenator.Fields.Item("bio").Value)%><br clear="all">
  <br clear="all">
  <%=(rssenator.Fields.Item("address").Value)%><br clear="all">
  <%=(rssenator.Fields.Item("city").Value)%>, <%=(rssenator.Fields.Item("country").Value)%>&nbsp; <%=(rssenator.Fields.Item("zip").Value)%><br clear="all">
  Email  <%=(rssenator.Fields.Item("email").Value)%></p>
</td>
    </tr>
    <tr>
      <td style="border-left-width:medium; border-right-width:medium; border-bottom-width:medium">
      <p align="right"><span style="font-size: 4pt">&nbsp;</span></td>
    </tr>
    <tr>
      <td style="border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium; border-top-style:solid; border-top-width:1px; border-bottom-style:none; border-bottom-width:medium" bgcolor="#373737" height="25">
      <p align="center">
      <font face="Trebuchet MS" color="#FFFFFF" style="font-size: 7.5pt; text-transform:uppercase">© 
  THE GOVERNMENT OF THE REPUBLIC OF PALAU COPYRIGHT 2005-2007.&nbsp; ALL 
      RIGHTS RESERVED.&nbsp; <a href="../Disclaimer.asp"><font color="#FFFFFF">DISCLAIMER NOTICE</font></a>.</font></td>
    </tr>
    <tr>
      <td style="border-style:none; border-width:medium; " bgcolor="#666666" height="25">
      <p align="center">
      <font face="Trebuchet MS" color="#FFFFFF" style="font-size: 7.5pt; text-transform:uppercase">LAST UPDATE
      <!--webbot bot="Timestamp" S-Type="REGENERATED" S-Format="%B %Y" startspan -->April 2009<!--webbot bot="Timestamp" i-checksum="13843" endspan -->.&nbsp;
      SITE 
      CREATED AND MAINTAINED BY <a href="http://www.olekoi.com">
      <font color="#FFFFFF">OLEKOI PALAU</font></a>.</font></td>
    </tr>
    </table>
  </div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-8267900-3");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
 
</html>
[+][-]09/26/09 10:34 PM, ID: 25432875Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Active Server Pages (ASP)
Sign Up Now!
Solution Provided By: gawai
Participating Experts: 2
Solution Grade: A
 
[+][-]09/26/09 06:21 PM, ID: 25432355Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/26/09 10:36 PM, ID: 25432879Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625