Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - ASP help needed
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ASP help needed

 Post Reply Post Reply
Author
flapper View Drop Down
Newbie
Newbie
Avatar

Joined: 27 January 2003
Location: England
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote flapper Quote  Post ReplyReply Direct Link To This Post Topic: ASP help needed
    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 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

Back to Top
tuga View Drop Down
Newbie
Newbie


Joined: 03 March 2003
Location: Portugal
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote tuga Quote  Post ReplyReply Direct Link To This Post 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 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 =

Back to Top
flapper View Drop Down
Newbie
Newbie
Avatar

Joined: 27 January 2003
Location: England
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote flapper Quote  Post ReplyReply Direct Link To This Post Posted: 06 March 2003 at 11:53am

umm

NO!

Back to Top
Bunce View Drop Down
Senior Member
Senior Member
Avatar

Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bunce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
flapper View Drop Down
Newbie
Newbie
Avatar

Joined: 27 January 2003
Location: England
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote flapper Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
flapper View Drop Down
Newbie
Newbie
Avatar

Joined: 27 January 2003
Location: England
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote flapper Quote  Post ReplyReply Direct Link To This Post Posted: 09 March 2003 at 5:01pm

Thanks for the tip mate.

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

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post 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

Edited by MorningZ
Contribute to the working anarchy we fondly call the Internet
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.