Print Page | Close Window

ASP help needed

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=758
Printed Date: 29 March 2026 at 2:55am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: ASP help needed
Posted By: flapper
Subject: ASP help needed
Date Posted: 05 March 2003 at 5:46pm

Why does this not work??

It is used to create a new user?!

 

<%
set rsTbl = Server.CreateObject("ADODB.Recordset")
%>
<html>
<head>
<title>Create User</title>
<LINK REL="stylesheet" HREF="../css/style.css" TYPE="text/css">
<script language="VBScript">
Option Explicit
dim header, validation, FieldValue, message, intPos, x, strTemp
header = "Inter-Mural League"

function createform_OnSubmit()
createform_OnSubmit = False
Call Check(createform.username.Value,"Please enter a username.")
if validation = true then Call Check(createform.first_name.Value,"Please enter a first name.")
if validation = true then Call Check(createform.last_name.Value,"Please enter a last name.")
if validation = true then Call Check(createform.password.Value,"Please enter a Password.")
if validation = true then Call Check(createform.veriPass.Value,"Please enter a second password.")
if validation = true then
 if createform.password.Value <> createform.veriPass.Value then
  msgbox("Your two passwords do not match, please try again")
  validation = false
 end if
end if
if validation = true then Call Check(createform.phone_no.Value,"Please enter a phone number.")
if validation = true then Call CheckPhone(createform.phone_no.Value,"Phone number is incorrect format.")
if validation = true then Call Check(createform.email.Value,"Please enter an email address.")
if validation = true then call CheckEmail(createform.email.Value,"The email entered is not of the correct format mailto:someone@somewhere.suffix - someone@somewhere.suffix . Please try again")
if validation = true then
 createform_OnSubmit = True
else
 createform_OnSubmit = False
End if
End Function
<!--#include file="validation.inc"-->
</script>
</head>
<body>
<!--#include file="connect.inc"-->
<table>
<tr><th colspan="3">Fields marked with a <font color="#FF0000" size="4"><b>*</b></font> are compulsory</th></tr>
<form name="createform" method="post" action="response.asp">
<%
set rsTbl = Server.CreateObject("ADODB.Recordset")
rsTbl.open "SELECT * FROM Users", conn, 1, 3
For each strField in rsTbl.Fields
 strFieldN = strField.Name
 strFieldN = ucase(left(strFieldN,1)) & mid(strFieldN, 2, len(strFieldN))
 intMark = inStr(strFieldN,"_")
 if intMark > 1 then
  strleft = mid(strFieldN, 1, intMark-1) & " "
  strRight = ucase(left(mid(strFieldN, intMark+1, len(strFieldN)-intMark),1)) & mid(strFieldN, intMark+2, len(strFieldN))
  strFieldN = strLeft & strRight
 end if
 if strField.name <> "club_name" AND strField.name <> "approved" AND strField.name <> _
   "warning" AND strField.name <> "level" AND strField.name <> "allow_login" AND _
   strField.name <> "post_approved" AND strField.name <> "status" AND strField.name <> _
   "attempts" AND strField.name <> "password" AND strField.name <> "available" AND _
   strField.name <> "player_id" AND strField.Name <> "position" AND strField.Name <> _
   "manager" AND strField.Name <> "fixture_id" AND strField.Name <> "home_team" AND _
    strField.Name <> "away_team" AND strField.Name <> "venue" then
  if strField.Name="username" OR strField.Name="email" OR strField.Name="first_name" OR _
   strField.Name="last_name" OR strField.Name="home_colours" OR strField.Name="away_colours" OR _
   strField.Name="date" OR strField.Name = "time" OR strField.Name = "phone_no" then
   response.write "<tr><th>" & strFieldN & ":</th><td><input type='text' name='" & strField.Name & "' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>"
  else
   response.write "<tr><th>" & strFieldN & ":</th><td><input type='text' name='" & strField.Name & "' /></td></tr>"
  end if
 elseif strField.name = "club_name" OR strField.name = "home_team" OR _
    strField.name = "away_team" then
  if strFunc <> "club" then
   response.write "<tr><th>" & strFieldN & ":</th><td><Select name='" & strField.Name & "'>"
   set rsClub = Server.CreateObject("ADODB.Recordset")
   rsClub.open "SELECT club_name FROM club ORDER BY club_name", conn, 1, 3
   DO UNTIL rsClub.eof
    club_name = rsClub("club_name")
    intMark = inStr(club_name," ")
    if intMark > 1 then
     strleft = mid(club_name, 1, intMark-1) & "_"
     strRight = mid(club_name, intMark+1, len(club_name))
     club_name = strLeft & strRight
    end if
    response.write "<OPTION value=" & club_name & ">" & rsClub("club_name") & "</OPTION>"
    rsClub.MOVENEXT
   LOOP
    response.write "</SELECT></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>"
   rsClub.Close
  else
   response.write "<tr><th>" & strFieldN & ":</th><td><input type='text' name='" & strField.Name & "' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>"
  end if
 elseif strField.name = "password" then
  response.write "<tr><th>Password:</th><td><input type='password' name='" & strField.Name & "' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>"
  response.write "<tr><th>Retype Password:</th><td><input type='password' name='veriPass' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>"
 elseif strField.name = "manager" OR strField.name = "available" then
  response.write "<tr><th>" & strFieldN & "</th><td><input type='checkbox' name='" & strField.name & "' /></td></tr>"
 elseif strField.name = "venue" then
  response.write "<tr><th>" & strFieldN & ":</th><td><Select name='" & strField.Name & "'>"
  for x = 1 to 6
   response.write "<OPTION value='pitch" & x & "'>Pitch " & x & "</OPTION>"
  next
  response.write "</select></td></tr>"
 elseif strField.name = "position" then
  response.write "<tr><th>" & strFieldN & ":</th><td><Select name='" & strField.Name & "'>"
  response.write "<option value='Goalkeeper'>Goalkeeper</option>"
  response.write "<option value='Defender'>Defender</option>"
  response.write "<option value='Midfielder'>Midfielder</option>"
  response.write "<option value='Striker'>Striker</option>"
  response.write "</select></td></tr>"
end if
Next
set rsTbl = nothing
set conn = nothing
response.wri




Replies:
Posted By: tuga
Date Posted: 05 March 2003 at 6:44pm
[QUOTE=flapper]

Why does this not work??

It is used to create a new user?!

 

<%
set rsTbl = Server.CreateObject("ADODB.Recordset")
%>
<html>
<head>
<title>Create User</title>
<LINK REL="stylesheet" HREF="../css/style.css" TYPE="text/css">
<script language="VBScript">
<% Option Explicit
dim header, validation, FieldValue, message, intPos, x, strTemp
header = "Inter-Mural League"

function createform_OnSubmit()
createform_OnSubmit = False
Call Check(createform.username.Value,"Please enter a username.")
if validation = true then Call Check(createform.first_name.Value,"Please enter a first name.")
if validation = true then Call Check(createform.last_name.Value,"Please enter a last name.")
if validation = true then Call Check(createform.password.Value,"Please enter a Password.")
if validation = true then Call Check(createform.veriPass.Value,"Please enter a second password.")
if validation = true then
 if createform.password.Value <> createform.veriPass.Value then
  msgbox("Your two passwords do not match, please try again")
  validation = false
 end if
end if
if validation = true then Call Check(createform.phone_no.Value,"Please enter a phone number.")
if validation = true then Call CheckPhone(createform.phone_no.Value,"Phone number is incorrect format.")
if validation = true then Call Check(createform.email.Value,"Please enter an email address.")
if validation = true then call CheckEmail(createform.email.Value,"The email entered is not of the correct format mailto:someone@somewhere.suffix - someone@somewhere.suffix . Please try again")
if validation = true then
 createform_OnSubmit = True
else
 createform_OnSubmit = False
End if
End Function
<!--#include file="validation.inc"-->
</script>
</head>
<body>
<!--#include file="connect.inc"-->
<table>
<tr><th colspan="3">Fields marked with a <font color="#FF0000" size="4"><b>*</b></font> are compulsory</th></tr>
<form name="createform" method="post" action="response.asp">
<%
set rsTbl = Server.CreateObject("ADODB.Recordset")
rsTbl.open "SELECT * FROM Users", conn, 1, 3
For each strField in rsTbl.Fields
 strFieldN = strField.Name
 strFieldN = ucase(left(strFieldN,1)) & mid(strFieldN, 2, len(strFieldN))
 intMark = inStr(strFieldN,"_")
 if intMark > 1 then
  strleft = mid(strFieldN, 1, intMark-1) & " "
  strRight = ucase(left(mid(strFieldN, intMark+1, len(strFieldN)-intMark),1)) & mid(strFieldN, intMark+2, len(strFieldN))
  strFieldN = strLeft & strRight
 end if
 if strField.name <> "club_name" AND strField.name <> "approved" AND strField.name <> _
   "warning" AND strField.name <> "level" AND strField.name <> "allow_login" AND _
   strField.name <> "post_approved" AND strField.name <> "status" AND strField.name <> _
   "attempts" AND strField.name <> "password" AND strField.name <> "available" AND _
   strField.name <> "player_id" AND strField.Name <> "position" AND strField.Name <> _
   "manager" AND strField.Name <> "fixture_id" AND strField.Name <> "home_team" AND _
    strField.Name <> "away_team" AND strField.Name <> "venue" then
  if strField.Name="username" OR strField.Name="email" OR strField.Name="first_name" OR _
   strField.Name="last_name" OR strField.Name="home_colours" OR strField.Name="away_colours" OR _
   strField.Name="date" OR strField.Name = "time" OR strField.Name = "phone_no" then
   response.write "<tr><th>" & strFieldN & ":</th><td><input type='text' name='" & strField.Name & "' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>"
  else
   response.write "<tr><th>" & strFieldN & ":</th><td><input type='text' name='" & strField.Name & "' /></td></tr>"
  end if
 elseif strField.name = "club_name" OR strField.name = "home_team" OR _
    strField.name = "away_team" then
  if strFunc <> "club" then
   response.write "<tr><th>" & strFieldN & ":</th><td><Select name='" & strField.Name & "'>"
   set rsClub = Server.CreateObject("ADODB.Recordset")
   rsClub.open "SELECT club_name FROM club ORDER BY club_name", conn, 1, 3
   DO UNTIL rsClub.eof
    club_name = rsClub("club_name")
    intMark = inStr(club_name," ")
    if intMark > 1 then
     strleft = mid(club_name, 1, intMark-1) & "_"
     strRight = mid(club_name, intMark+1, len(club_name))
     club_name = strLeft & strRight
    end if
    response.write "<OPTION value=" & club_name & ">" & rsClub("club_name") & "</OPTION>"
    rsClub.MOVENEXT
   LOOP
    response.write "</SELECT></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>"
   rsClub.Close
  else
   response.write "<tr><th>" & strFieldN & ":</th><td><input type='text' name='" & strField.Name & "' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>"
  end if
 elseif strField.name = "password" then
  response.write "<tr><th>Password:</th><td><input type='password' name='" & strField.Name & "' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>"
  response.write "<tr><th>Retype Password:</th><td><input type='password' name='veriPass' /></td><td><font color='#FF0000' size='4'><b>*</b></font></td></tr>"
 elseif strField.name = "manager" OR strField.name = "available" then
  response.write "<tr><th>" & strFieldN & "</th><td><input type='checkbox' name='" & strField.name & "' /></td></tr>"
 elseif strField.name = "venue" then
  response.write "<tr><th>" & strFieldN & ":</th><td><Select name='" & strField.Name & "'>"
  for x = 1 to 6
   response.write "<OPTION value='pitch" & x & "'>Pitch " & x & "</OPTION>"
  next
  response.write "</select></td></tr>"
 elseif strField.name = "position" then
  response.write "<tr><th>" & strFieldN & ":</th><td><Select name='" & strField.Name & "'>"
  response.write "<option value='Goalkeeper'>Goalkeeper</option>"
  response.write "<option value='Defender'>Defender</option>"
  response.write "<option value='Midfielder'>Midfielder</option>"
  response.write "<option value='Striker'>Striker</option>"
  response.write "</select></td></tr>"
end if
Next
set rsTbl =



Posted By: flapper
Date Posted: 06 March 2003 at 11:53am

umm

NO!



Posted By: Bunce
Date Posted: 07 March 2003 at 1:03am
  • Whats the error?
  • Post only the code that impacts on the error, rather than us having wade through all this code.

 



-------------
There have been many, many posts made throughout the world...
This was one of them.


Posted By: flapper
Date Posted: 07 March 2003 at 6:54am
Im afraid i dont know what the error is, the data is not writing to the database, hence no error being submitted


Posted By: Gullanian
Date Posted: 09 March 2003 at 4:54pm
1) Option explicit should always be at the TOP of the document, not top of the code, so the first line on the page should be <% Option Explicit %>

2) Use flags to see where the code is failing.  For example in certain points of the code do something like <%response.write("im here")%> then you can track the data flow and pinpoint the location of the error


Posted By: flapper
Date Posted: 09 March 2003 at 5:01pm

Thanks for the tip mate.

Why didnt i think of using flags (maybe coz im dumbass lol)



Posted By: MorningZ
Date Posted: 09 March 2003 at 9:32pm
and if you are looking for people to take time to help you out, posting smart ass replies like:

Originally posted by flapper flapper wrote:

umm


NO!



don't help matters

-------------
Contribute to the working anarchy we fondly call the Internet



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net