Need help with ASP Code - Internal Server Error 500
-
Hey folks,
I'm working on registration form for volunteers on a website I'm developing, and I can't figure this one out. Everything worked fine until I added the 3 drop down menus on this first page here. Now, when I go to register and validate the form, it adds the recordset to my database (I went in and checked, the records are there), but it then shows a Internal Server Error - 500 without a redirect to the email.asp. I'm not sure where the problem is, I didn't think I changed the code on the volreg.asp page other than to accomodate the new form values. Any help would be great.
-Jordan Burke
volregister.asp:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>South Florida FIRST Lego League | News * Resources * Forum</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>FLL Menu</title>
<script language="JavaScript" src="menu.js"></script>
<script language="JavaScript" src="menu_items.js"></script>
<script language="JavaScript" src="menu_tpl.js"></script>
<link rel="stylesheet" href="menu.css">
<link href="main.css" rel="stylesheet" type="text/css">
</head><body>
<div id="header">
<img src="images/TopBanner.jpg" width="337" height="100" align="absbottom"></div><div id="links" style="height: 75%; ">
<script language="JavaScript">
new menu (MENU_ITEMS, MENU_TPL);
</script>
</div>
<div id="center">
<h2>Member Registration</h2>
<p>Please fill out the following form to register as a member, and
gain access to our members area.</p>
<%=strError%>
<form action="volreg.asp" method="POST">
<input type="hidden" name="action" value="register">
<table border="0">
<tr>
<td><p>First Name</p></td>
<td><input type="text" maxlength=30 name="fname"
value="<%=Server.HTMLEncode(Request.Form("fname"))%>"></td>
</tr>
<tr>
<td><p>Last Name</p></td>
<td><input type="text" maxlength=30 name="lname"
value="<%=Server.HTMLEncode(Request.Form("lname"))%>"></td>
</tr>
<tr>
<td><p>Email Address</p></td>
<td><input type="text" maxlength=50 name="email"
value="<%=Server.HTMLEncode(Request.Form("email"))%>"></td>
</tr>
<tr>
<td><p>Phone Number</p></td>
<td><input type="text" maxlength=10 name="phone"></td>
</tr>
<tr>
<td><p>Address</p></td>
<td><input type="text" maxlength=50 name="addr"
value="<%=Server.HTMLEncode(Request.Form("addr"))%>"></td>
</tr>
<tr>
<td><p>City</p></td>
<td><input type="text" maxlength=30 name="city"
value="<%=Server.HTMLEncode(Request.Form("city"))%>"></td>
</tr>
<tr>
<td><p>School Fax Number (If applicable)</p></td>
<td><input type="text" maxlength=10 name="fax"
value="<%=Server.HTMLEncode(Request.Form("fax"))%>"></td>
</tr>
<tr>
<td><p>Years volunteering for FLL<br>(Including This Year)</p></td>
<td><input type="text" maxlength=2 name="fllvol"
value="<%=Server.HTMLEncode(Request.Form("fllvol"))%>"></td>
</tr>
<tr>
<td><p>T-shirt Size</p></td>
<td><input type="text" maxlength=30 name="tssize"
value="<%=Server.HTMLEncode(Request.Form("tssize"))%>"></td>
</tr>
<tr>
<td><p>AIM Screen Name</p></td>
<td><input type="text" maxlength=30 name="aim"
value="<%=Server.HTMLEncode(Request.Form("aim"))%>"></td>
</tr>
<tr>
<td><p>Yahoo Screen Name</p></td>
<td><input type="text" maxlength=30 name="yim"
value="<%=Server.HTMLEncode(Request.Form("yim"))%>"></td>
</tr>
<tr>
<td><p>FIRST Team Number<br>(If Applicable)</p></td>
<td><input type="text" name="firstnum"
value="<%=Server.HTMLEncode(Request.Form("firstnum"))%>"></td>
</tr>
<tr>
<td colspan="2"><div align="center">Put a 1, 2, or 3 beside your top 3 preferences for Volunteering:</div></td>
</tr><tr>
<td><p>First Choice</p></td>
<td><select name="choice1" size="1">
<option>Referee</option>
<option>Field Reset</option>
<option>Judging</option>
<option>Queuing</option>
<option>Scoring</option>
<option>Crowd Control</option>
<option>Volunteer Registration</option>
<option>Team Registration</option>
<option>Field Setup/Breakdown</option>
<option>Videography</option>
<option>FLL Forum Moderator</option>
<option>Other</option>
</select></td>
</tr>
<tr>
<td><p>Second Choice</p></td>
<td><select name="choice2" size="1">
<option>Referee</option>
<option>Field Reset</option>
<option>Judging</option>
<option>Queuing</option>
<option>Scoring</option>
<option>Crowd Control</option>
<option>Volunteer Registration</option>
<option>Team Registration</option>
<option>Field Setup/Breakdown</option>
<option>Videography</option>
<option>FLL Forum Moderator</option>
<option>Other</option>
</select></td>
</tr>
<tr>
<td><p>Third Choice</p></td>
<td><select name="choice3" size="1">
<option>Referee</option>
<option>Field Reset</option>
<option>Judging</option>
<option>Queuing</option>
<option>Scoring</option>
<option>Crowd Control</option>
<option>Volunteer Registration</option>
<option>Team Registration</option>
<option>Field Setup/Breakdown</option>
<option>Videography</option>
<option>FLL Forum Moderator</option>
<option>Other</option>
</select></td>
</tr>
<tr>
<td></td>
<td><input name="submit" type="submit" value="Complete Registration"></td>
</tr>
</table>
</form></div>
<div id="footer">
<h1> South Florida FLL - Powered By <a href="http://www.epiktechnologies.com/prometheus.htm" target="_blank">The Prometheus Project </a></h1>
<p> </p>
</div>
</body>
</html>volreg.asp:
<%Option Explicit
Dim strError, strSQL
'see if the form has been submitted
If Request.Form("action")="register" Then
'the form has been submitted'// validate the form
'check if a username has been entered
If Request.Form("email") = "" Then _
strError = strError & "- Please enter a Email Address<br>" & vbNewLine'check if a password has been entered
If Request.Form("lname") = "" Then _
strError = strError & "- Please enter your name<br>" & vbNewLine'// check if an error has occured
If strError = "" Then
'continue
'include database connection code
%>
<!--#include file="inc-dbconnection.asp"-->
<%
On Error Resume Next'// create the SQL
strSQL = "INSERT INTO VOLUNTEER (fname,lname,email,phone,addr,city,fax,fllvol,tssize,aim,yim,firstnum,choice1,choice2,choice3) VALUES " & _
"('" & fixQuotes(Request.Form("fname")) & "','" & _
fixQuotes(Request.Form("lname")) & "','" & _
fixQuotes(Request.Form("email")) & "','" & _
fixQuotes(Request.Form("phone")) & "','" & _
fixQuotes(Request.Form("addr")) & "','" & _
fixQuotes(Request.Form("city")) & "','" & _
fixQuotes(Request.Form("fax")) & "','" & _
fixQuotes(Request.Form("fllvol")) & "','" & _
fixQuotes(Request.Form("tssize")) & "','" & _
fixQuotes(Request.Form("aim")) & "','" & _
fixQuotes(Request.Form("yim")) & "','" & _
fixQuotes(Request.Form("firstnum")) & "','" & _
fixQuotes(Request.Form("choice1")) & "','" & _
fixQuotes(Request.Form("choice2")) & "','" & _
fixQuotes(Request.Form("choice3")) & "')"
'// run the SQL
objConn.Execute strSQL
'// check for an error
'// ATTENTION: this should be changed depending on the database provider
If Err.Number = -2147467259 Then
strError = "- That username is already in use. Please choose another<br>" & vbNewLine
ElseIf Err.Number <> 0 Then
strError = "- An error occured. " & Err.Number & " : " & _
Err.Description & "<br>" & vbNewLine
Else
'record created... redirect
Response.Redirect "email.asp")
Response.End
End If'restore standard error handling
On Error Goto 0End If
If strError <> "" Then
'output the error message
'add extra HTML...
strError = "<p><font color=""#FF0000"">The following errors occured:" & _
"</font><br>" & vbNewLine & strError
End If
End IfFunction fixQuotes(strData)
fixQuotes = Replace(strData,"'","''")
End Function
%>email.asp:
<!--#include file="inc-dbconnection.asp"-->
<%
DIM mySQL
mySQL = "SELECT PHONE, EMAIL, FNAME, LNAME, choice1, choice2, chioce3 FROM VOLUNTEER"DIM objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open mySQL, objConndim fullname
fullname = objRS("fname") & " " & objRS("lname")%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>South Florida FIRST Lego League | News * Resources * Forum</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>FLL Menu</title>
<script language="JavaScript" src="menu.js"></script>
<script language="JavaScript" src="menu_items.js"></script>
<script language="JavaScript" src="menu_tpl.js"></script>
<link rel="stylesheet" href="menu.css">
<link href="main.css" rel="stylesheet" type="text/css">
</head><body>
<div id="header">
<img src="images/TopBanner.jpg" width="337" height="100" align="absbottom"></div><div id="links" style="height: 75%; ">
<script language="JavaScript">
new menu (MENU_ITEMS, MENU_TPL);
</script>
</div>
<div id="center"><p>Welcome <% =fullname %>!</p>
<table>
<tr><td><p>Phone Number: <% Response.Write objRS("phone") %></p></td></tr>
<tr><td><p>Email Address:<% Response.Write objRS("email") %></p></td></tr>
<tr><td><p>1st Choice: <% Response.Write objRS("choice1") %></p></td></tr>
<tr><td><p>2nd Choice: <% Response.Write objRS("choice2") %></p></td></tr>
<tr><td><p>3rd Choice: <% Response.Write objRS("choice3") %></p></td></tr>
</table>
<p>Thank you for supporting South Florida FLL!</p>
</div><div id="footer">
<h1> South Florida FLL - Powered By <a href="http://www.epiktechnologies.com/prometheus.htm" target="_blank">The Prometheus Project </a></h1>
<p> </p>
</div>
</body>
</html> -
Okay, quick update:
I've determined that the problem seems to be with the line in volreg.asp:
Response.Redirect "email.asp"
For some reason, if I use the original code (which some of you may recognize as James Crowley's Members Area code) and redirect it to login.asp, it works. I'm really scratching my head here, as I didn't have this issue before. Thanks again for any thoughts out there.
EditPlease forgive me... I just reread my code, and I had "choice" spelled as "chioce", which is obviously enough for an error. Sorry to anyone out there who spent any time on this, I appreciate it.
Post a reply
Quick links
Recent activity
- arif ahmad replied to How to receive data in web ...
- William Thompson replied to What is the name of the Win...
- Sameera Piyadigamage replied to Point of Sale Developers: H...
- Scott Carline replied to 4 x C# Developers for large...
- Rajendra Dhakal replied to Restore SQL Server text dat...
- cloud rainda replied to How to convert between TS f...
Enter your message below
Sign in or Join us (it's free).