Solved

Classic ASP: Multiple Identical fields when choose from a list menu for each team member on a loop

Posted on 2008-10-16
10
240 Views
Last Modified: 2011-09-20
Hi, I have a current Team Registration form in which a Member can register Team members for upcoming tournaments.  The problem is that , the way I am implementing the code , it is onlymailing  the first member of a team of 5 and not all 5 of them. Can you tell me how do I accomplish this. ?
' Memeber Registration 

 

	If (Request.Form("Submit")<>"") Then	

	

		set rs_val = Server.Createobject("ADODB.Recordset")

		ccnt=0

		c=0

					

		sql_res_val="select max(TIID) from players"

		rs_val.open sql_res_val,conSQL

		if rs_val(0)<>""  Then

			TIID=rs_val(0)+1

		Else

			TIID=1000

		End if

		session("r_mcount") = Request.Form("mcount")

		session("r_tourname") = Request.Form("tourname")

		session("r_txtcourseid") = Request.Form("txtcourseid")

		

		'do we need an user name also here ? 

		'session("r_txtuname")=request.form("txtuname")

		For p=1 to request.form("mcount")

		

					session("r_txtfname"&p) = Request.Form("txtfname"&p)

					session("r_txtlname"&p) = Request.Form("txtlname"&p)

					'session("r_txtemailid"&p) = Request.Form("txtemailid"&p)

					

					response.write "tname :" & session("r_txtfname"&p)

					

					txtteamname=request.form("txtteamname"&p)

					txtfname=request.form("txtfname"&p)

					txtlname=request.form("txtlname"&p)

					txtaddr1=request.form("txtaddr1"&p)

					txtaddr2=request.form("txtaddr2"&p)

					txtcity=request.form("txtcity"&p)

					txtstate=request.form("txtstate"&p)

					txtcourseid=request.form("txtcourseid"&p)

					txtpcode=request.form("txtpcode"&p)

					txtcontactno=request.form("txtcontactno"&p)

					txtemailid=request.form("txtemailid"&p)

					txtshirtsize=request.form("txtshirtsize"&p)

					txthandicap=request.form("txthandicap"&p)

					txthomecourse=request.form("txthomecourse"&p)

					regdate=date()

					regtime=time()

					'allemails = allemails &txtemailid

					

					

										

					

					

					response.Write("txtteamname")		

					conSQL.execute("Insert into Players(teamname,firstname,lastname,addy1,addy2,city,state,Zip,phone,email,regdate,regtime,TourID,Shirtsize,Handicap,courseID,TIID) values('"&txtteamname&"','"&txtfname&"', '"&txtlname&"','"&txtaddr1&"','"&txtaddr2&"','"&txtcity&"','"&txtstate&"','"&txtpcode&"','"&txtcontactno&"','"&txtemailid&"','"&regdate&"','"&regtime&"','"&TID&"','"&txtshirtsize&"','"&txthandicap&"',"&txthomecourse&","&TIID&")")

			

					Set rsNewListMember=Server.CreateObject("ADODB.Recordset")

					

					strSQL = "SELECT tblMailingList.* FROM tblMailingList;"

					rsNewListMember.Open strSQL, con3SQL

				

					Randomize Timer

						

			strUserCode = Left(strEmailAddress,2) & (9876989856 * CInt((RND * 32000) + 100))

				

					Do While NOT rsNewListMember.EOF	

					

					If strUserCode = rsNewListMember("ID_Code") Then

					

						Randomize Timer

						

						strUserCode = Left(strEmailAddress,2) & (9876989856 * CInt((RND * 32000) + 100))

					

					rsNewListMember.MoveFirst

					End If	

					

					If strEmailAddress = txtemailid Then

						blnError = True

						Exit Do

					End If

					

Set MyCDO =CreateObject("CDO.Message")

	

			

			MyCDO.To = txtemailid

			'MyCDO.Bcc=txtemaild

			'MyCDO.Cc=txtemailid

			

			MyCDO.From = "info@playerscores.com"

			MyCDO.Subject = "Tournament signup confirmation from playerscores.com "

		

					MyCDO.HTMLBody = " <br><br>Thanks for registering your team<b> "& request.form("txtteamname")&"</b> online with the <b>"& request.form("tourname") &"</b><br> If you have any questions please do not hesitate to email us at info@playerscores.com <br><br>Thanks<br>PlayerScores.com Staff"

					

					

MyCDO.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

'Name or IP of remote SMTP server

MyCDO.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserver") _

="192.168.5.235"

'Server port

MyCDO.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _

=25 

MyCDO.Configuration.Fields.Update

 

 

MyCDO.Send

 

'response.write("allemails")

 

 

If Err.Number <> 0 Then

				Response.Write "Error: " & Err.Description

			    response.end

			    end if

						

					

					rsNewListMember.MoveNext	

				Loop	

				

		If blnError = False Then

		Set rsNewListMemberc = Server.CreateObject("ADODB.Recordset")

		strSQLC = "SELECT * FROM tblMailingList where Email='"&txtemailid&"'"

		rsNewListMemberC.Open strSQLC, con3SQL

	If rsNewListMemberC.EOF Then

con3SQL.execute("Insert into tblMailingList(Email,ID_Code) values('"&txtemailid&"','"&strUserCode&"')")

					End If

				End If

				

				rsNewListMember.Close

				Set rsNewListMember = Nothing

				

							

			Next			

								

			

			'Set rsNewListMember1=Server.CreateObject("ADODB.Recordset")

			'strSQL1 = "SELECT Tourfee FROM tblTournament where TourID="&TID&";"

			'rsNewListMember1.Open strSQL1, conSQL

			

					' Are we charging a fee to register a tournament?

					

					'if rsNewListMember1("Tourfee") <> 0 then

					'url="thank.asp"

					'response.redirect(url)

					'else

					'On Error resume Next

									

 

				

				' clean up 

				set MyCDO=nothing

				url="thank.asp"

					response.redirect(url)

					end if 

	

%>

Open in new window

0
Comment
Question by:RickyGtz
  • 5
  • 4
10 Comments
 
LVL 9

Expert Comment

by:deathtospam
Comment Utility
My guess is that it's exiting the Do While loop because of the following code block:

===============================================
If strEmailAddress = txtemailid Then
      blnError = True
      Exit Do
End If
===============================================


Try adding a line of debugging code right before that If..Then statement, to see if it's coming true.

===============================================
Response.Write "strEmailAddress = txtemailid? " & (strEmailAddress = txtemailid) & "<br>":  Response.Flush

If strEmailAddress = txtemailid Then
      blnError = True
      Exit Do
End If
===============================================
0
 

Author Comment

by:RickyGtz
Comment Utility
HI this is what i got

tname :rwerwetxtteamnamestrEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
tname :fsdfsdtxtteamnamestrEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False
strEmailAddress = txtemailid? False


And So on....


What Can I do to fix this?
0
 

Author Comment

by:RickyGtz
Comment Utility
Anyone?
0
 
LVL 4

Expert Comment

by:rhodesb
Comment Utility
What is being passed in the txtemailid field?  If it is just one address, then that is the only address you are sending to.  If it is multiple addresses, they must be separated by semicolons (;).

Also, in lines 62, 70 and 75, you reference the variable strEmailAddress which is never set to be equal to anything in this code.
0
 

Author Comment

by:RickyGtz
Comment Utility
I want to pass each member on the team email adresses.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 4

Expert Comment

by:rhodesb
Comment Utility
I mean what is currently being passed into that variable?  I don't know what your form looks like that passes data into this page.  show me the code for the form or show me the result of response.write(txtemailid) sometime before the email is sent.
0
 

Author Comment

by:RickyGtz
Comment Utility
this is the original form


<% 

	level="../"

	response.buffer=true

	Response.ExpiresAbsolute = Now() - 1

 	Response.Expires = 0

 	Response.CacheControl = "no-cache"
 

%>

<!--#include file="../include/intialize.inc"-->

<!--#include file="../include/connection.asp"-->

<!-- #include File="../include/logincheck.asp" -->

<%

If request.form("T_name")<>"" Then

tourname=request.form("T_name")

Else

tourname=request.form("tourname")

End If

'response.write "tourname--"& tourname
 

If request.form("T_Id")<>"" Then

	TID=request.form("T_Id")

Else

	TID=request.form("TID")

End If

' Memeber Registration 
 

	If (Request.Form("Submit")<>"") Then	

	

		set rs_val = Server.Createobject("ADODB.Recordset")

		ccnt=0

		c=0

		

		

		

		

		sql_res_val="select max(TIID) from players"

		rs_val.open sql_res_val,con

		if rs_val(0)<>""  Then

			TIID=rs_val(0)+1

		Else

			TIID=1000

		End if

		session("r_mcount") = Request.Form("mcount")

		session("r_tourname") = Request.Form("tourname")

		session("r_txtcourseid") = Request.Form("txtcourseid")

		'do we need an user name also here ? 

		'session("r_txtuname")=request.form("txtuname")

		For p=1 to request.form("mcount")

		

					session("r_txtfname"&p) = Request.Form("txtfname"&p)

					session("r_txtlname"&p) = Request.Form("txtlname"&p)

					session("r_txtemailid"&p) = Request.Form("txtemailid"&p)

					

					response.write "tname :" & session("r_txtfname"&p)

					

					txtfname=request.form("txtfname"&p)

					txtlname=request.form("txtlname"&p)

					txtaddr1=request.form("txtaddr1"&p)

					txtaddr2=request.form("txtaddr2"&p)

					txtcity=request.form("txtcity"&p)

					txtstate=request.form("txtstate"&p)

					txtcourseid=request.form("txtcourseid"&p)

					txtpcode=request.form("txtpcode"&p)

					txtcontactno=request.form("txtcontactno"&p)

					txtemailid=request.form("txtemailid"&p)

					txtshirtsize=request.form("txtshirtsize"&p)

					txthandicap=request.form("txthandicap"&p)

					txthomecourse=request.form("txthomecourse"&p)

					regdate=date()

					regtime=time()

					

								

					con.execute("Insert into Players(firstname,lastname,addy1,addy2,city,state,Zip,phone,email,regdate,regtime,TourID,Shirtsize,Handicap,courseID,TIID) values('"&txtfname&"','"&txtlname&"','"&txtaddr1&"','"&txtaddr2&"','"&txtcity&"','"&txtstate&"','"&txtpcode&"','"&txtcontactno&"','"&txtemailid&"','"&regdate&"','"&regtime&"','"&TID&"','"&txtshirtsize&"','"&txthandicap&"',"&txthomecourse&","&TIID&")")

			

					Set rsNewListMember=Server.CreateObject("ADODB.Recordset")

					

					strSQL = "SELECT tblMailingList.* FROM tblMailingList;"

					rsNewListMember.Open strSQL, con3

				

					Randomize Timer

						

					strUserCode = Left(strEmailAddress,2) & (9876989856 * CInt((RND * 32000) + 100))

				

					Do While NOT rsNewListMember.EOF	

					

					If strUserCode = rsNewListMember("ID_Code") Then

					

						Randomize Timer

						

						strUserCode = Left(strEmailAddress,2) & (9876989856 * CInt((RND * 32000) + 100))

					

						rsNewListMember.MoveFirst

					End If	

					

					If strEmailAddress = txtemailid Then

						blnError = True

						Exit Do

					End If

					rsNewListMember.MoveNext	

				Loop	

				

				If blnError = False Then

				Set rsNewListMemberc = Server.CreateObject("ADODB.Recordset")

				strSQLC = "SELECT * FROM tblMailingList where Email='"&txtemailid&"'"

					rsNewListMemberC.Open strSQLC, con3

					If rsNewListMemberC.EOF Then

					con3.execute("Insert into tblMailingList(Email,ID_Code) values('"&txtemailid&"','"&strUserCode&"')")

					End If

				End If

				

				rsNewListMember.Close

				Set rsNewListMember = Nothing

				

							

			Next			

								
 

			Set rsNewListMember1=Server.CreateObject("ADODB.Recordset")

			strSQL1 = "SELECT Tourfee FROM tblTournament where TourID="&TID&";"

			rsNewListMember1.Open strSQL1, con

					if rsNewListMember1("Tourfee") <> 0 then

					url="register_step2.asp"

					response.redirect(url)

					else

					On Error resume Next

					

					Set myMail=CreateObject("CDO.Message")

myMail.Subject="Thanks For your Registration with Playerscores.com "

myMail.From="info@playerscores.com"

myMail.To= txtemailid

myMail.HTMLBody= sql

myMail.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

'Name or IP of remote SMTP server

myMail.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserver") _

="192.168.5.235"

'Server port

myMail.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _

=25 

myMail.Configuration.Fields.Update

myMail.Send

If Err.Number <> 0 Then

				Response.Write "Error: " & Err.Description

			    response.end

			    end if

				

				' clean up 

				set myMail=nothing

					

											

					

					

					TBdy=""

					Set MyCDO =CreateObject("CDO.Message")

					MyCDO.To = txtemailid

					MyCDO.From = "info@playerscores.com"

					MyCDO.Subject = "from playerscores"

					TBdy = TBdy & " <br><br>Thanks for registering your team online with the ("& request.form("tourname") &")<br>If you have any questions please do not hesitate to email us at info@playerscores.com <br><br>Thanks<br>PlayerScores.com Staff"

					MyCDO.HTMLBody = TBdy

					MyCDO.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

'Name or IP of remote SMTP server

MyCDO.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserver") _

="192.168.5.235"

'Server port

MyCDO.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _

=25 

MyCDO.Configuration.Fields.Update

MyCDO.Send

If Err.Number <> 0 Then

				Response.Write "Error: " & Err.Description

			    response.end

			    end if

				

				' clean up 

				set MyCDO=nothing

				url="thank.asp"

					response.redirect(url)

					end if 

	End If	

%>

<html>

<head>

<title><%=PageTitle%></title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link href="../style/style.css" rel="stylesheet" type="text/css">

<script language="JavaScript">

function validate_all()

	{

		errmsg="";

	for(i=1;i<=document.regfrm.mcount.value;i++)

	{

		//errmsg +="Player"+i+"\n\n";

		if (eval("document.regfrm.txtfname"+i+".value")=="")

			errmsg +="Player"+i+" Firstname Field is Blank \n";

		if (eval("document.regfrm.txtaddr1"+i+".value")=="")

			errmsg +="Player"+i+ " Address Field is Blank \n";

		if (eval("document.regfrm.txtcity"+i+".value")=="")

			errmsg +="Player"+i+ " City Field is Blank \n";		

		if (eval("document.regfrm.txtstate"+i+".value")=="")

			errmsg +="Player"+i+ " State Field is Blank \n";

		if (eval("document.regfrm.txtpcode"+i+".value")=="")

			errmsg +="Player"+i+ " Zip Code Field is Blank \n";		

		if (eval("document.regfrm.txtcontactno"+i+".value")=="")

			errmsg +="Player"+i+ " Contact Number Field is Blank \n";		

		if (eval("document.regfrm.txtemailid"+i+".value")=="")

			errmsg +="Player"+i+ " Email ID Field is Blank \n";		

		else

		{

			var err=0

			mailid = eval("document.regfrm.txtemailid"+i+".value");

			val=mailid.indexOf("@");

			if (val!=-1)

			{

			  val1=mailid.indexOf(".");

			  if (val1==-1)

				err=1;	

			}  

			else

				err=1;

			

			if (err==1)

				  errmsg +="Player"+i+ " Invalid Email ID \n";

		}
 

		if (eval("document.regfrm.txthandicap"+i+".value")=="")

			errmsg +="Player"+i+ " Handicap Field is Blank \n";		

		if (eval("document.regfrm.txthomecourse"+i+".value")=="")

			errmsg +="Player"+i+ " Home Course Field is Blank \n";	

			

	}

	if (errmsg=="")         

	{

		return true;

	}

	else

	{

		alert(" Following Error Have Occured While Submiting This Form:\n\n"+errmsg);

		return false;

	}

}
 

function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}
 

function YY_checkform() { //v4.66

//copyright (c)1998,2002 Yaromat.com

  var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;

  for (var i=1; i<args.length;i=i+4){

    if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}

    var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));

    myV=myObj.value;

    if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){

      if (myReq&&myObj.value.length==0){addErr=true}

      if ((myV.length>0)&&(args[i+2]==1)){ //fromto

        var myMa=args[i+1].split('_');if(isNaN(myV)||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}

      } else if ((myV.length>0)&&(args[i+2]==2)){

          var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;

      } else if ((myV.length>0)&&(args[i+2]==3)){ // date

        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);

        if(myAt){

          var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];

          var myDate=new Date(myY,myM,myD);

          if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};

        }else{addErr=true}

      } else if ((myV.length>0)&&(args[i+2]==4)){ // time

        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}

      } else if (myV.length>0&&args[i+2]==5){ // check this 2

            var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));

            if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];

            if(!myObj1.checked){addErr=true}

      } else if (myV.length>0&&args[i+2]==6){ // the same

            var myObj1 = MM_findObj(args[i+1]);

            if(myV!=myObj1.value){addErr=true}

      }

    } else

    if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){

          var myTest = args[i].match(/(.*)\[(\d+)\].*/i);

          var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;

      if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}

      if (args[i+2]==2){

        var myDot=false;

        for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}

        if(!myDot){myErr+='* ' +args[i+3]+'\n'}

      }

    } else if (myObj.type=='checkbox'){

      if(args[i+2]==1&&myObj.checked==false){addErr=true}

      if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}

    } else if (myObj.type=='select-one'||myObj.type=='select-multiple'){

      if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}

    }else if (myObj.type=='textarea'){

      if(myV.length<args[i+1]){addErr=true}

    }

    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}

  }

  if (myErr!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr)}

  document.MM_returnValue = (myErr=='');

}

function MM_validateForm() { //v4.0

  if (document.getElementById){

    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;

    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);

      if (val) { nm=val.name; if ((val=val.value)!="") {

        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');

          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';

        } else if (test!='R') { num = parseFloat(val);

          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';

          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');

            min=test.substring(8,p); max=test.substring(p+1);

            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';

      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }

    } if (errors) alert('The following error(s) occurred:\n'+errors);

    document.MM_returnValue = (errors == '');

} }

</script>
 
 

<script language="JavaScript">

<!--

function isAlpha ( evt ) {

   var keyCode = evt.which ? evt.which : evt.keyCode;

   alpha = ( keyCode >= 'a'.charCodeAt ( ) &&

      keyCode <= 'z'.charCodeAt ( ) ) || 

      ( keyCode >= 'A'.charCodeAt ( ) &&

      keyCode <= 'Z'.charCodeAt ( ) ) || 

      ( keyCode >= 8 && keyCode <= 46 );

   return ( alpha );

}
 

function validateAlpha ( text ) {

   for ( c=0; c < text.length; c ++ ) {

      alpha = ( text.charCodeAt ( c ) >= 65 &&

         text.charCodeAt ( c ) <=90 ) || 

         ( text.charCodeAt ( c ) >= 97 &&

         text.charCodeAt ( c ) <=122 )

      if ( !alpha ) {

         alert ( 'No way, sorry.' );   

         document.theForm.theField.select ( );

         return false;

      }

   }

   return true;

}

//-->

</script>
 
 
 

</head>

<body background="<%=level%>images/bg.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="775" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr> 

    <td colspan="4" valign="top"><!--#include file="../include/header.asp"--></td>

  </tr>

  <tr>

    <td width="192" valign="top" bgcolor="#ffffff"><!-- #include file="../include/left.asp" --></td>

    <td width="591" valign="top" bgcolor="#ffffff">

      <form name="regfrm" method="post" action="" onSubmit="return validateNumber (this.theField.value )">

        <table width="88%" border="0" align="center" cellpadding="0" cellspacing="0" class="bodytxt1">

          <% if (msg<>"") then %>

          <tr> 

            <td width="100%" height="30" colspan="2" align="center" class="errortxt"><%=msg%></td>

          </tr>

          <% end if %>

        </table>

        <table width="423"  border="0" cellspacing="0" cellpadding="0" align="center" class="bodytxt1">

          <tr>

            <td width="28"><img src="<%=Level%>images/tbleft.jpg" width="28" height="24"></td>

            <td width="279" class="tableheader1">New User Sign Up &nbsp;for Tournament&nbsp;</td>

            <td width="116"><img src="<%=Level%>images/tbright.jpg" width="28" height="24"></td>

          </tr>

          <tr> 

            <td colspan="3" valign="top" bgcolor="#5eb020"> 

              <table width="100%"  border="0" cellspacing="1" cellpadding="0" class="bodytxt1" >

                <tr>

                  <td valign="top" bgcolor="#FFFFFF" class="tablebgcolor"><br>

                  Please Select the Tournament Members :

				  <select name="mcount" onChange="javascript:submit();">

				  <option value="1" <% if request.form("mcount")=1 then Response.write "selected" %>>1</option>

				  <option value="2" <% if request.form("mcount")=2 then Response.write "selected" %>>2</option>

				  <option value="3" <% if request.form("mcount")=3 then Response.write "selected" %>>3</option>

				  <option value="4" <% if request.form("mcount")=4 then Response.write "selected" %>>4</option>

				  <option value="5" <% if request.form("mcount")=5 then Response.write "selected" %>>5</option>

				  </select>

				   <br>

                  <br></td>

                </tr>

				<tr> 

                  <td valign="top" bgcolor="#FFFFFF" class="tablebgcolor"> 

				<%

				nct=request.form("mcount")

				'nct=play

				if nct="" then

				nct=1

				End if

				For i=1 to nct 

				%>

				<table width="100%" height="100%" align="center" cellpadding="5" cellspacing="0" class="bodytxt1" >

                      <tr align="left"> 

                        <td colspan="2" class="tableheader" >Player<%=i%> Personal Information 

                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Tournament Name</td>

                        <td width="60%"> <%=tourname%>

                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >First Name</td>

                        <td width="60%"> &nbsp; 

                          <input name="txtfname<%=i%>" type="text" class="txtbox1"  onKeyDown="

   if ( !isAlpha ( event ) ) {

      alert ( 'Please enter only letters on this field .' );

      return false;

   }" value=<%=request.form("txtfname"&i)%> > 

                       

                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Last Name</td>

                        <td width="60%"> &nbsp; 

                          <input type="text" name="txtlname<%=i%>" class="txtbox1"  onKeyDown="

   if ( !isAlpha ( event ) ) {

      alert ( 'Please enter only letters on this field .' );

      return false;

   }"

                           VALUE=<%=request.form("txtlname"&i)%> >

                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Address</td>

                        <td width="60%"> &nbsp; 

                          <input type="text" name="txtaddr1<%=i%>" class="txtbox2" VALUE="<%=request.form("txtaddr1"&i)%>">

                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right">Address</td>

                        <td width="60%"> &nbsp; 

                          <input type="text" name="txtaddr2<%=i%>" class="txtbox2" VALUE="<%=request.form("txtaddr2"&i)%>">

                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >City </td>

                        <td width="60%"> &nbsp; 

                          <input type="text" name="txtcity<%=i%>" class="txtbox1"  onKeyDown="

   if ( !isAlpha ( event ) ) {

      alert ( 'Please enter only letters on this field .' );

      return false;

   }"

                           VALUE=<%=request.form("txcity"&i)%> >

  

                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >State</td>

                        <td width="60%"> &nbsp; 

                        <select name="txtstate<%=i%>"class="txtbox1" 

                        value="<%=request.form("txtstate"&i)%>">

                            <option selected>--Choose a State--</option>

                            <option value="AL">Alabama</option>

                            <option value="AK">Alaska</option>

                            <option value="AZ">Arizona</option>

                            <option value="AR">Arkansas</option>

                            <option value="CA">California</option>

                            <option value="CO">Colorado</option>

                            <option value="CT">Connecticut</option>

                            <option value="DE">Delaware</option>

                            <option value="FL">Florida</option>

                            <option value="GA">Georgia</option>

                            <option value="HI">Hawaii</option>

                            <option value="ID">Idaho</option>

                            <option value="IL">Illinois</option>

                            <option value="IN">Indiana</option>

                            <option value="IA">Iowa</option>

                            <option value="KS">Kansas</option>

                            <option value="KY">Kentucky</option>

                            <option value="LA">Louisiana</option>

                            <option value="ME">Maine</option>

                            <option value="MD">Maryland</option>

                            <option value="MA">Massachusetts</option>

                            <option value="MI">Michigan</option>

                            <option value="MN">Minnesota</option>

                            <option value="MS">Mississippi</option>

                            <option value="MO">Missouri</option>

                            <option value="MT">Montana</option>

                            <option value="NE">Nebraska</option>

                            <option value="NV">Nevada</option>

                            <option value="NH">New Hampshire</option>

                            <option value="NJ">New Jersey</option>

                            <option value="NM">New Mexico</option>

                            <option value="NY">New York</option>

                            <option value="NF">Newfoundland</option>

                            <option value="NC">North Carolina</option>

                            <option value="ND">North Dakota</option>

                            <option value="OH">Ohio</option>

                            <option value="OK">Oklahoma</option>

                            <option value="OR">Oregon</option>

                            <option value="PA">Pennsylvania</option>

                            <option value="RI">Rhode Island</option>

                            <option value="SC">South Carolina</option>

                            <option value="SD">South Dakota</option>

                            <option value="TN">Tennessee</option>

                            <option value="TX">Texas</option>

                            <option value="UT">Utah</option>

                            <option value="VT">Vermont</option>

                            <option value="VA">Virginia</option>

                            <option value="WA">Washington</option>

                            <option value="DC">Washington, D.C.</option>

                            <option value="WV">West Virginia</option>

                            <option value="WI">Wisconsin</option>

                            <option value="WY">Wyoming</option>

                          </select>

                 

                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Zip Code</td>

                        <td width="60%"> &nbsp; 

                          <input name="txtpcode<%=i%>" type="text" class="txtbox1" tabindex="5" VALUE="<%=request.form("txtpcode"&i)%>" maxlength="5">

                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Contact Number</td>

                        <td width="60%"> &nbsp; 

                          <input name="txtcontactno<%=i%>" type="text" class="txtbox1" id="txtcontactno<%=i%>" onBlur="MM_validateForm('txtcontactno<%=i%>','','NisNum');return document.MM_returnValue" VALUE="<%=request.form("txtcontactno"&i)%>">

                        </td>

                      </tr>

                      <tr>

                        <td align="right" >Email Address</td>

                        <td>&nbsp;	<input NAME="txtemailid<%=i%>" type="text" class="combobox1" id="txtemailid<%=i%>" onBlur="YY_checkform('regfrm','txtemailid<%=i%>','#S','2','E-mail  is not valid. Please Enter a valid Email. ');return document.MM_returnValue" VALUE="<%=request.form("txtemailid"&i)%>"></td>

                      </tr>

                      <tr>

                        <td align="right" >Shirt Size </td>

                        <td> &nbsp; 

			<select name="txtshirtsize<%=i%>" width="3" VALUE="<%=request.form("txtshirtsize"&i)%>">

			  <option>Small</option>

			  <option>Medium</option>

			  <option>Large</option>

			  <option>X-Large</option>

			  <option>XX-Large</option>

			  <option>XXX-Large</option>  

						</select>

                    </td>

                      </tr>

                      <tr>

                        <td align="right" >Handicap </td>

                        <td> &nbsp; 

						<input type="text" name="txthandicap<%=i%>" class="combobox1" VALUE="<%=request.form("txthandicap"&i)%>"></td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Home Course </td>

                        <td width="60%"> &nbsp; 

						<select name="txthomecourse<%=i%>" class="combobox1">

                            <option value="">--Choose The Course--</option>

                            <%

							  set Rs_Course = con.execute("select * from courses")

							  while Not Rs_Course.Eof 

								response.Write("<option value="&Rs_Course("CourseID")&">"&Rs_Course("Name")&"</option>")							  	

								Rs_Course.MoveNext

							  wend 

							  %>

                        </select> 

                        </td>

                      </tr>

					  <% 

					  If int(i)=int(nct) Then %>

                      <tr align="center" > 

                        <td colspan="2" > 

						                          <input type="hidden" name="tourname" value="<%=tourname%>">

						   <input type="hidden" name="TID" value=<%=TID%>>
 

                          <input type="submit" name="Submit" value="Submit" class="button1" onClick="return validate_all()">

                          <input type="reset" name="Submit2" value="Reset" class="button1">

                        </td>

                      </tr>

					  <% End If %>

                    </table>

               <%

			   Next

			   %>

                  </td>

				</tr>

              </table>

            </td>

          </tr>

        </table>

        <br>

        <br>

      </form>    </td>

    <td width="1" valign="top" bgcolor="#285E8E"></td>

    <!--

    <td width="161" valign="top" bgcolor="#FFFFFF"> 

      <!--include file="../include/right.asp"

    </td> -->

    

    

  </tr>

  <tr> 

    <td colspan="4">

      <!--#include file="../include/footer.asp"-->

    </td>

  </tr>

</table>

</body>

</html>

Open in new window

0
 
LVL 4

Expert Comment

by:rhodesb
Comment Utility
After looking carefully through your code, I think that the email should be sending to only the last member of the team of 5 and not the first one like you said.  Either way, there is a logic mistake in your code for sending out the emails and it is as follows:
In your code, it looks like you are sending 2 emails using myMail and MyCDO objects but both of these are sending to the same person because myMail.To = txtemailid and MyCDO.TO = txtemailid.
The problem is that because your email code is outside of the For loop that starts on Line 48 (the one that reads all your fields from the form and inputs them into the database), txtemailid only contains the email address from the last iteration through the loop and thus only 1 email address.
Like I said above, if you do a response.write(txtemailid) right before myMail.To = ... and MyCDO.To = ..., you will see that there is only 1 email address going into that field.

For a solution, you can either move your email code inside the for loop so that it sends out the email to the correct person each time through the loop or you can build a temporary variable to store all of the email addresses in one variable and then use that variable in the myMail.To and MyCDO.To fields.  i.e.
Dim outgoingEmails
Then somewhere inside the For loop, after txtemailid has been set (by request.form), add to that variable:
outgoingEmails = outgoingEmails & txtemailid & "; "
Then right after your loop, strip the final semicolon off (not sure if you have to do this or not, I use a different mailing object):
outgoingEmails = Left(outgoingEmails,Len(outgoingEmails)-2) <-- use -2 if they are seperated by semicolon and a space, or -1 if they are seperated by just a semicolon
Finally, set myMail.To = outgoingEmails and MyCDO.To = outgoingEmails

Hopefully I have explained the problem clearly enough for you.  If you have any other questions or need some clarification, please ask.
0
 

Author Comment

by:RickyGtz
Comment Utility
Hi it sending to all emails but many times to each member I am guessing the looping is the problem,,



<% 

	level="../"

	'response.buffer=true

	'Response.ExpiresAbsolute = Now() - 1

 	'Response.Expires = 0

 	'Response.CacheControl = "no-cache"
 

%>

<!--#include file="../include/intialize.inc"-->

<!--include file="../include/connection.asp"-->

<!--#include file="../../Connections/sqlConn1.asp" -->

<!--#include file="../../Connections/sqlConn3.asp" -->
 

<!-- #include File="../include/logincheck.asp" -->

<%

If request.form("T_name")<>"" Then

tourname=request.form("T_name")

Else

tourname=request.form("tourname")

End If

'response.write "tourname--"& tourname
 

If request.form("T_Id")<>"" Then

	TID=request.form("T_Id")

Else

	TID=request.form("TID")

End If

' Memeber Registration 
 

	If (Request.Form("Submit")<>"") Then	

	

		set rs_val = Server.Createobject("ADODB.Recordset")

		ccnt=0

		c=0

					

		sql_res_val="select max(TIID) from players"

		rs_val.open sql_res_val,conSQL

		if rs_val(0)<>""  Then

			TIID=rs_val(0)+1

		Else

			TIID=1000

		End if

		session("r_mcount") = Request.Form("mcount")

		session("r_tourname") = Request.Form("tourname")

		session("r_txtcourseid") = Request.Form("txtcourseid")

		

		'do we need an user name also here ? 

		'session("r_txtuname")=request.form("txtuname")

		For p=1 to request.form("mcount")

		

					session("r_txtfname"&p) = Request.Form("txtfname"&p)

					session("r_txtlname"&p) = Request.Form("txtlname"&p)

					'session("r_txtemailid"&p) = Request.Form("txtemailid"&p)

					

					response.write "tname :" & session("r_txtfname"&p)

					

					txtteamname=request.form("txtteamname"&p)

					txtfname=request.form("txtfname"&p)

					txtlname=request.form("txtlname"&p)

					txtaddr1=request.form("txtaddr1"&p)

					txtaddr2=request.form("txtaddr2"&p)

					txtcity=request.form("txtcity"&p)

					txtstate=request.form("txtstate"&p)

					txtcourseid=request.form("txtcourseid"&p)

					txtpcode=request.form("txtpcode"&p)

					txtcontactno=request.form("txtcontactno"&p)

					txtemailid=request.form("txtemailid"&p)

					txtshirtsize=request.form("txtshirtsize"&p)

					txthandicap=request.form("txthandicap"&p)

					txthomecourse=request.form("txthomecourse"&p)

					regdate=date()

					regtime=time()

					'allemails = allemails &txtemailid

					

					

										

					

					

					response.Write("txtteamname")		

					conSQL.execute("Insert into Players(teamname,firstname,lastname,addy1,addy2,city,state,Zip,phone,email,regdate,regtime,TourID,Shirtsize,Handicap,courseID,TIID) values('"&txtteamname&"','"&txtfname&"', '"&txtlname&"','"&txtaddr1&"','"&txtaddr2&"','"&txtcity&"','"&txtstate&"','"&txtpcode&"','"&txtcontactno&"','"&txtemailid&"','"&regdate&"','"&regtime&"','"&TID&"','"&txtshirtsize&"','"&txthandicap&"',"&txthomecourse&","&TIID&")")

			

					Set rsNewListMember=Server.CreateObject("ADODB.Recordset")

					

					strSQL = "SELECT tblMailingList.* FROM tblMailingList;"

					rsNewListMember.Open strSQL, con3SQL

				

					Randomize Timer

						dim strEmailAdress

						strEmailAdress=""

			strUserCode = Left(strEmailAddress,2) & (9876989856 * CInt((RND * 32000) + 100))

				

					Do While NOT rsNewListMember.EOF	

					

					If strUserCode = rsNewListMember("ID_Code") Then

					

						Randomize Timer

						

						strUserCode = Left(strEmailAddress,2) & (9876989856 * CInt((RND * 32000) + 100))

					

					rsNewListMember.MoveFirst

					End If	

					

' debuging to see if it is comming true 
 
 

Response.Write "strEmailAddress = txtemailid? " & (strEmailAddress = txtemailid) & "<br>":  Response.Flush
 

If strEmailAddress = txtemailid Then

      blnError = True

      Exit Do

End If
 

					

					

					

					If strEmailAddress = txtemailid Then

						blnError = True

						Exit Do

					End If

					

Set MyCDO =CreateObject("CDO.Message")

	

			

			MyCDO.To = txtemailid

			'MyCDO.Bcc=txtemaild

			'MyCDO.Cc=txtemailid

			

			MyCDO.From = "info@playerscores.com"

			MyCDO.Subject = "Tournament signup confirmation from playerscores.com "

		

					MyCDO.HTMLBody = " <br><br>Thanks for registering your team<b> "& request.form("txtteamname")&"</b> online with the <b>"& request.form("tourname") &"</b><br> If you have any questions please do not hesitate to email us at info@playerscores.com <br><br>Thanks<br>PlayerScores.com Staff"

					

					

MyCDO.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

'Name or IP of remote SMTP server

MyCDO.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserver") _

="192.168.5.235"

'Server port

MyCDO.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _

=25 

MyCDO.Configuration.Fields.Update
 
 

MyCDO.Send
 

'response.write("allemails")
 
 

If Err.Number <> 0 Then

				Response.Write "Error: " & Err.Description

			    response.end

			    end if

						

					

					rsNewListMember.MoveNext	

				Loop	

				

		If blnError = False Then

		Set rsNewListMemberc = Server.CreateObject("ADODB.Recordset")

		strSQLC = "SELECT * FROM tblMailingList where Email='"&txtemailid&"'"

		rsNewListMemberC.Open strSQLC, con3SQL

	If rsNewListMemberC.EOF Then

con3SQL.execute("Insert into tblMailingList(Email,ID_Code) values('"&txtemailid&"','"&strUserCode&"')")

					End If

				End If

				

				rsNewListMember.Close

				Set rsNewListMember = Nothing

				

							

			Next			

								

			

			'Set rsNewListMember1=Server.CreateObject("ADODB.Recordset")

			'strSQL1 = "SELECT Tourfee FROM tblTournament where TourID="&TID&";"

			'rsNewListMember1.Open strSQL1, conSQL

			

					' Are we charging a fee to register a tournament?

					

					'if rsNewListMember1("Tourfee") <> 0 then

					'url="thank.asp"

					'response.redirect(url)

					'else

					'On Error resume Next

									
 

				

				' clean up 

				set MyCDO=nothing

				url="thank.asp"

					response.redirect(url)

					end if 

	

%>

<html>

<head>

<title><%=PageTitle%></title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link href="../style/style.css" rel="stylesheet" type="text/css">

<script language="JavaScript">

function validate_all()

	{

		errmsg="";

	for(i=1;i<=document.regfrm.mcount.value;i++)

	{

		//errmsg +="Player"+i+"\n\n";

		if (eval("document.regfrm.txtfname"+i+".value")=="")

			errmsg +="Player"+i+" Firstname Field is Blank \n";

		if (eval("document.regfrm.txtaddr1"+i+".value")=="")

			errmsg +="Player"+i+ " Address Field is Blank \n";

		if (eval("document.regfrm.txtcity"+i+".value")=="")

			errmsg +="Player"+i+ " City Field is Blank \n";		

		if (eval("document.regfrm.txtstate"+i+".value")=="")

			errmsg +="Player"+i+ " State Field is Blank \n";

		if (eval("document.regfrm.txtpcode"+i+".value")=="")

			errmsg +="Player"+i+ " Zip Code Field is Blank \n";		

		if (eval("document.regfrm.txtcontactno"+i+".value")=="")

			errmsg +="Player"+i+ " Contact Number Field is Blank \n";		

		if (eval("document.regfrm.txtemailid"+i+".value")=="")

			errmsg +="Player"+i+ " Email ID Field is Blank \n";		

		else

		{

			var err=0

			mailid = eval("document.regfrm.txtemailid"+i+".value");

			val=mailid.indexOf("@");

			if (val!=-1)

			{

			  val1=mailid.indexOf(".");

			  if (val1==-1)

				err=1;	

			}  

			else

				err=1;

			

			if (err==1)

				  errmsg +="Player"+i+ " Invalid Email ID \n";

		}
 

		if (eval("document.regfrm.txthandicap"+i+".value")=="")

			errmsg +="Player"+i+ " Handicap Field is Blank \n";		

		if (eval("document.regfrm.txthomecourse"+i+".value")=="")

			errmsg +="Player"+i+ " Home Course Field is Blank \n";	

			

	}

	if (errmsg=="")         

	{

		return true;

	}

	else

	{

		alert(" Following Error Have Occured While Submiting This Form:\n\n"+errmsg);

		return false;

	}

}
 

function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}
 

function YY_checkform() { //v4.66

//copyright (c)1998,2002 Yaromat.com

  var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;

  for (var i=1; i<args.length;i=i+4){

    if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}

    var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));

    myV=myObj.value;

    if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){

      if (myReq&&myObj.value.length==0){addErr=true}

      if ((myV.length>0)&&(args[i+2]==1)){ //fromto

        var myMa=args[i+1].split('_');if(isNaN(myV)||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}

      } else if ((myV.length>0)&&(args[i+2]==2)){

          var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;

      } else if ((myV.length>0)&&(args[i+2]==3)){ // date

        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);

        if(myAt){

          var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];

          var myDate=new Date(myY,myM,myD);

          if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};

        }else{addErr=true}

      } else if ((myV.length>0)&&(args[i+2]==4)){ // time

        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}

      } else if (myV.length>0&&args[i+2]==5){ // check this 2

            var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));

            if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];

            if(!myObj1.checked){addErr=true}

      } else if (myV.length>0&&args[i+2]==6){ // the same

            var myObj1 = MM_findObj(args[i+1]);

            if(myV!=myObj1.value){addErr=true}

      }

    } else

    if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){

          var myTest = args[i].match(/(.*)\[(\d+)\].*/i);

          var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;

      if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}

      if (args[i+2]==2){

        var myDot=false;

        for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}

        if(!myDot){myErr+='* ' +args[i+3]+'\n'}

      }

    } else if (myObj.type=='checkbox'){

      if(args[i+2]==1&&myObj.checked==false){addErr=true}

      if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}

    } else if (myObj.type=='select-one'||myObj.type=='select-multiple'){

      if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}

    }else if (myObj.type=='textarea'){

      if(myV.length<args[i+1]){addErr=true}

    }

    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}

  }

  if (myErr!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr)}

  document.MM_returnValue = (myErr=='');

}

function MM_validateForm() { //v4.0

  if (document.getElementById){

    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;

    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);

      if (val) { nm=val.name; if ((val=val.value)!="") {

        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');

          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';

        } else if (test!='R') { num = parseFloat(val);

          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';

          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');

            min=test.substring(8,p); max=test.substring(p+1);

            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';

      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }

    } if (errors) alert('The following error(s) occurred:\n'+errors);

    document.MM_returnValue = (errors == '');

} }

</script>
 
 

<script language="JavaScript">

<!--

function isAlpha ( evt ) {

   var keyCode = evt.which ? evt.which : evt.keyCode;

   alpha = ( keyCode >= 'a'.charCodeAt ( ) &&

      keyCode <= 'z'.charCodeAt ( ) ) || 

      ( keyCode >= 'A'.charCodeAt ( ) &&

      keyCode <= 'Z'.charCodeAt ( ) ) || 

      ( keyCode >= 8 && keyCode <= 46 );

   return ( alpha );

}
 

function validateAlpha ( text ) {

   for ( c=0; c < text.length; c ++ ) {

      alpha = ( text.charCodeAt ( c ) >= 65 &&

         text.charCodeAt ( c ) <=90 ) || 

         ( text.charCodeAt ( c ) >= 97 &&

         text.charCodeAt ( c ) <=122 )

      if ( !alpha ) {

         alert ( 'No way, sorry.' );   

         document.theForm.theField.select ( );

         return false;

      }

   }

   return true;

}

//-->

</script>
 
 
 

</head>

<body background="<%=level%>images/bg.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="775" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr> 

    <td colspan="4" valign="top"><!--#include file="../include/header.asp"--></td>

  </tr>

  <tr>

    <td width="192" valign="top" bgcolor="#ffffff"><!-- #include file="../include/left.asp" --></td>

    <td width="591" valign="top" bgcolor="#ffffff">

      <form name="regfrm" method="post" action="" onSubmit="return validateNumber (this.theField.value )">

        <table width="88%" border="0" align="center" cellpadding="0" cellspacing="0" class="bodytxt1">

          <% if (msg<>"") then %>

          <tr> 

            <td width="100%" height="30" colspan="2" align="center" class="errortxt"><%=msg%></td>

          </tr>

          <% end if %>

        </table>

        <table width="423"  border="0" cellspacing="0" cellpadding="0" align="center" class="bodytxt1">

          <tr>

            <td width="28"><img src="<%=Level%>images/tbleft.jpg" width="28" height="24"></td>

            <td width="279" class="tableheader1">New User Sign Up &nbsp;for Tournament&nbsp;</td>

            <td width="116"><img src="<%=Level%>images/tbright.jpg" width="28" height="24"></td>

          </tr>

          <tr> 

            <td colspan="3" valign="top" bgcolor="#5eb020"> 

              <table width="100%"  border="0" cellspacing="1" cellpadding="0" class="bodytxt1" >

                <tr>

                  <td valign="top" bgcolor="#FFFFFF" class="tablebgcolor"><br>

                  Please Select the Tournament Members :

				  <select name="mcount" onChange="javascript:submit();">

				  <option value="1" <% if request.form("mcount")=1 then Response.write "selected" %>>1</option>

				  <option value="2" <% if request.form("mcount")=2 then Response.write "selected" %>>2</option>

				  <option value="3" <% if request.form("mcount")=3 then Response.write "selected" %>>3</option>

				  <option value="4" <% if request.form("mcount")=4 then Response.write "selected" %>>4</option>

				  <option value="5" <% if request.form("mcount")=5 then Response.write "selected" %>>5</option>

				  </select>

				   <br>

                  <br></td>

                </tr>

				<tr> 

                  <td valign="top" bgcolor="#FFFFFF" class="tablebgcolor"> 

				<%

				nct=request.form("mcount")

				'nct=play

				if nct="" then

				nct=1

				End if

				For i=1 to nct 

				%>

				<table width="100%" height="100%" align="center" cellpadding="5" cellspacing="0" class="bodytxt1" >

                      <tr align="left"> 

                        <td colspan="2" class="tableheader" >Player<%=i%> Personal Information                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Tournament Name</td>

                        <td width="60%"> <%=tourname%>                        </td>

                      </tr>

                      <tr>

                        <td align="right" >Team Name</td>

                        <td>  &nbsp;

                        <input name="txtteamname<%=i%>" type="text" class="txtbox1" id="txtteamname<%=i%>" onBlur="YY_checkform('regfrm','txtteamname<%=i%>2','#q','0','Field \'txtteamname<%=i%>2\' is not valid.');return document.MM_returnValue"  onKeyDown="

   if ( !isAlpha ( event ) ) {

      alert ( 'Please enter only letters on this field .' );

      return false;

   }" value="<%=request.form("txtteamname"&i)%>"  ></td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >First Name</td>

                        <td width="60%"> &nbsp; 

                          <input name="txtfname<%=i%>" type="text" class="txtbox1"  onKeyDown="

   if ( !isAlpha ( event ) ) {

      alert ( 'Please enter only letters on this field .' );

      return false;

   }" value=<%=request.form("txtteamname"&i)%> >                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Last Name</td>

                        <td width="60%"> &nbsp; 

                          <input type="text" name="txtlname<%=i%>" class="txtbox1"  onKeyDown="

   if ( !isAlpha ( event ) ) {

      alert ( 'Please enter only letters on this field .' );

      return false;

   }"

                           VALUE=<%=request.form("txtlname"&i)%> >                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Address</td>

                        <td width="60%"> &nbsp; 

                          <input type="text" name="txtaddr1<%=i%>" class="txtbox2" VALUE="<%=request.form("txtaddr1"&i)%>">                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right">Address</td>

                        <td width="60%"> &nbsp; 

                          <input type="text" name="txtaddr2<%=i%>" class="txtbox2" VALUE="<%=request.form("txtaddr2"&i)%>">                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >City </td>

                        <td width="60%"> &nbsp; 

                          <input type="text" name="txtcity<%=i%>" class="txtbox1"  onKeyDown="

   if ( !isAlpha ( event ) ) {

      alert ( 'Please enter only letters on this field .' );

      return false;

   }"

                           VALUE=<%=request.form("txcity"&i)%> >                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >State</td>

                        <td width="60%"> &nbsp; 

                        <select name="txtstate<%=i%>"class="txtbox1" 

                        value="<%=request.form("txtstate"&i)%>">

                            <option selected>--Choose a State--</option>

                            <option value="AL">Alabama</option>

                            <option value="AK">Alaska</option>

                            <option value="AZ">Arizona</option>

                            <option value="AR">Arkansas</option>

                            <option value="CA">California</option>

                            <option value="CO">Colorado</option>

                            <option value="CT">Connecticut</option>

                            <option value="DE">Delaware</option>

                            <option value="FL">Florida</option>

                            <option value="GA">Georgia</option>

                            <option value="HI">Hawaii</option>

                            <option value="ID">Idaho</option>

                            <option value="IL">Illinois</option>

                            <option value="IN">Indiana</option>

                            <option value="IA">Iowa</option>

                            <option value="KS">Kansas</option>

                            <option value="KY">Kentucky</option>

                            <option value="LA">Louisiana</option>

                            <option value="ME">Maine</option>

                            <option value="MD">Maryland</option>

                            <option value="MA">Massachusetts</option>

                            <option value="MI">Michigan</option>

                            <option value="MN">Minnesota</option>

                            <option value="MS">Mississippi</option>

                            <option value="MO">Missouri</option>

                            <option value="MT">Montana</option>

                            <option value="NE">Nebraska</option>

                            <option value="NV">Nevada</option>

                            <option value="NH">New Hampshire</option>

                            <option value="NJ">New Jersey</option>

                            <option value="NM">New Mexico</option>

                            <option value="NY">New York</option>

                            <option value="NF">Newfoundland</option>

                            <option value="NC">North Carolina</option>

                            <option value="ND">North Dakota</option>

                            <option value="OH">Ohio</option>

                            <option value="OK">Oklahoma</option>

                            <option value="OR">Oregon</option>

                            <option value="PA">Pennsylvania</option>

                            <option value="RI">Rhode Island</option>

                            <option value="SC">South Carolina</option>

                            <option value="SD">South Dakota</option>

                            <option value="TN">Tennessee</option>

                            <option value="TX">Texas</option>

                            <option value="UT">Utah</option>

                            <option value="VT">Vermont</option>

                            <option value="VA">Virginia</option>

                            <option value="WA">Washington</option>

                            <option value="DC">Washington, D.C.</option>

                            <option value="WV">West Virginia</option>

                            <option value="WI">Wisconsin</option>

                            <option value="WY">Wyoming</option>

                          </select>                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Zip Code</td>

                        <td width="60%"> &nbsp; 

                          <input name="txtpcode<%=i%>" type="text" class="txtbox1" tabindex="5" VALUE="<%=request.form("txtpcode"&i)%>" maxlength="5">                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Contact Number</td>

                        <td width="60%"> &nbsp; 

                          <input name="txtcontactno<%=i%>" type="text" class="txtbox1" id="txtcontactno<%=i%>" onBlur="MM_validateForm('txtcontactno<%=i%>','','NisNum');return document.MM_returnValue" VALUE="<%=request.form("txtcontactno"&i)%>">                        </td>

                      </tr>

                      <tr>

                        

                        <td align="right" >Email Address</td>

                        <td>&nbsp;	<input NAME="txtemailid<%=i%>" type="text" class="combobox1" id="txtemailid<%=i%>" onBlur="YY_checkform('regfrm','txtemailid<%=i%>','#S','2','E-mail  is not valid. Please Enter a valid Email. ');return document.MM_returnValue" VALUE="<%=request.form("txtemailid"&i)%>"></td>

                      </tr>

                                  

                      <tr>

                        <td align="right" >Shirt Size </td>

                        <td> &nbsp; 

			<select name="txtshirtsize<%=i%>" width="3" VALUE="<%=request.form("txtshirtsize"&i)%>">

			  <option>Small</option>

			  <option>Medium</option>

			  <option>Large</option>

			  <option>X-Large</option>

			  <option>XX-Large</option>

			  <option>XXX-Large</option>

			  <option selected>--Choose a Size--</option>  

						</select>                    </td>

                      </tr>

                      <tr>

                        <td align="right" >Handicap </td>

                        <td> &nbsp; 

						<input type="text" name="txthandicap<%=i%>" class="combobox1" VALUE="<%=request.form("txthandicap"&i)%>"></td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Home Course </td>

                        <td width="60%"> &nbsp; 

						<select name="txthomecourse<%=i%>" class="combobox1">

                            <option value="">--Choose The Course--</option>

                            <%

							  set Rs_Course = conSQL.execute("select * from courses")

							  while Not Rs_Course.Eof 

								response.Write("<option value="&Rs_Course("CourseID")&">"&Rs_Course("Name")&"</option>")							  	

								Rs_Course.MoveNext

							  wend 

							  %>

                        </select>                        </td>

                      </tr>

					  <% 

					  If int(i)=int(nct) Then %>

                      <tr align="center" > 

                        <td colspan="2" > 

						                          <input type="hidden" name="tourname" value="<%=tourname%>">

						   <input type="hidden" name="TID" value=<%=TID%>>
 

                          <input type="submit" name="Submit" value="Submit" class="button1" onClick="return validate_all()">

                          <input type="reset" name="Submit2" value="Reset" class="button1">                        </td>

                      </tr>

					  <% End If %>

                    </table>

               <%

			   Next

			   %>

                  </td>

				</tr>

              </table>

            </td>

          </tr>

        </table>

        <br>

        <br>

      </form>    </td>

    <td width="1" valign="top" bgcolor="#285E8E"></td>

    <!--

    <td width="161" valign="top" bgcolor="#FFFFFF"> 

      <!--include file="../include/right.asp"

    </td> -->

    

    

  </tr>

  <tr> 

    <td colspan="4">

      <!--#include file="../include/footer.asp"-->

    </td>

  </tr>

</table>

</body>

</html>

Open in new window

0
 
LVL 4

Accepted Solution

by:
rhodesb earned 500 total points
Comment Utility
Try moving your email code out of the Do While Loop but still inside the For..Next Loop.  I've moved in and pasted it into the code below.
<% 

	level="../"

	'response.buffer=true

	'Response.ExpiresAbsolute = Now() - 1

 	'Response.Expires = 0

 	'Response.CacheControl = "no-cache"

 

%>

<!--#include file="../include/intialize.inc"-->

<!--include file="../include/connection.asp"-->

<!--#include file="../../Connections/sqlConn1.asp" -->

<!--#include file="../../Connections/sqlConn3.asp" -->

 

<!-- #include File="../include/logincheck.asp" -->

<%

If request.form("T_name")<>"" Then

tourname=request.form("T_name")

Else

tourname=request.form("tourname")

End If

'response.write "tourname--"& tourname

 

If request.form("T_Id")<>"" Then

	TID=request.form("T_Id")

Else

	TID=request.form("TID")

End If

' Memeber Registration 

 

	If (Request.Form("Submit")<>"") Then	

	

		set rs_val = Server.Createobject("ADODB.Recordset")

		ccnt=0

		c=0

					

		sql_res_val="select max(TIID) from players"

		rs_val.open sql_res_val,conSQL

		if rs_val(0)<>""  Then

			TIID=rs_val(0)+1

		Else

			TIID=1000

		End if

		session("r_mcount") = Request.Form("mcount")

		session("r_tourname") = Request.Form("tourname")

		session("r_txtcourseid") = Request.Form("txtcourseid")

		

		'do we need an user name also here ? 

		'session("r_txtuname")=request.form("txtuname")

		For p=1 to request.form("mcount")

		

					session("r_txtfname"&p) = Request.Form("txtfname"&p)

					session("r_txtlname"&p) = Request.Form("txtlname"&p)

					'session("r_txtemailid"&p) = Request.Form("txtemailid"&p)

					

					response.write "tname :" & session("r_txtfname"&p)

					

					txtteamname=request.form("txtteamname"&p)

					txtfname=request.form("txtfname"&p)

					txtlname=request.form("txtlname"&p)

					txtaddr1=request.form("txtaddr1"&p)

					txtaddr2=request.form("txtaddr2"&p)

					txtcity=request.form("txtcity"&p)

					txtstate=request.form("txtstate"&p)

					txtcourseid=request.form("txtcourseid"&p)

					txtpcode=request.form("txtpcode"&p)

					txtcontactno=request.form("txtcontactno"&p)

					txtemailid=request.form("txtemailid"&p)

					txtshirtsize=request.form("txtshirtsize"&p)

					txthandicap=request.form("txthandicap"&p)

					txthomecourse=request.form("txthomecourse"&p)

					regdate=date()

					regtime=time()

					'allemails = allemails &txtemailid

					

					

										

					

					

					response.Write("txtteamname")		

					conSQL.execute("Insert into Players(teamname,firstname,lastname,addy1,addy2,city,state,Zip,phone,email,regdate,regtime,TourID,Shirtsize,Handicap,courseID,TIID) values('"&txtteamname&"','"&txtfname&"', '"&txtlname&"','"&txtaddr1&"','"&txtaddr2&"','"&txtcity&"','"&txtstate&"','"&txtpcode&"','"&txtcontactno&"','"&txtemailid&"','"&regdate&"','"&regtime&"','"&TID&"','"&txtshirtsize&"','"&txthandicap&"',"&txthomecourse&","&TIID&")")

			

					Set rsNewListMember=Server.CreateObject("ADODB.Recordset")

					

					strSQL = "SELECT tblMailingList.* FROM tblMailingList;"

					rsNewListMember.Open strSQL, con3SQL

				

					Randomize Timer

						dim strEmailAdress

						strEmailAdress=""

			        strUserCode = Left(strEmailAddress,2) & (9876989856 * CInt((RND * 32000) + 100))

				

					Do While NOT rsNewListMember.EOF	

					

				        If strUserCode = rsNewListMember("ID_Code") Then

    					

					        Randomize Timer

    						

					        strUserCode = Left(strEmailAddress,2) & (9876989856 * CInt((RND * 32000) + 100))

    					

				        rsNewListMember.MoveFirst

				        End If	

    					

                        ' debuging to see if it is comming true 

                         

                         

                        Response.Write "strEmailAddress = txtemailid? " & (strEmailAddress = txtemailid) & "<br>":  Response.Flush

                         

                        If strEmailAddress = txtemailid Then

                              blnError = True

                              Exit Do

                        End If

     

				        rsNewListMember.MoveNext	

                    Loop	
 

			        If strEmailAddress = txtemailid Then

				        blnError = True

				        Exit Do

			        End If

					

                    Set MyCDO =CreateObject("CDO.Message")

	

			

	                MyCDO.To = txtemailid

	                'MyCDO.Bcc=txtemaild

	                'MyCDO.Cc=txtemailid

        			

	                MyCDO.From = "info@playerscores.com"

	                MyCDO.Subject = "Tournament signup confirmation from playerscores.com "

        		

			        MyCDO.HTMLBody = " <br><br>Thanks for registering your team<b> "& request.form("txtteamname")&"</b> online with the <b>"& request.form("tourname") &"</b><br> If you have any questions please do not hesitate to email us at info@playerscores.com <br><br>Thanks<br>PlayerScores.com Staff"

					

					

                    MyCDO.Configuration.Fields.Item _

                    ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

                    'Name or IP of remote SMTP server

                    MyCDO.Configuration.Fields.Item _

                    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") _

                    ="192.168.5.235"

                    'Server port

                    MyCDO.Configuration.Fields.Item _

                    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _

                    =25 

                    MyCDO.Configuration.Fields.Update

                     

                     

                    MyCDO.Send

                     

                    'response.write("allemails")

                     

                     

                    If Err.Number <> 0 Then

		                            Response.Write "Error: " & Err.Description

	                                response.end

	                end if

				

		            If blnError = False Then

		                Set rsNewListMemberc = Server.CreateObject("ADODB.Recordset")

		                strSQLC = "SELECT * FROM tblMailingList where Email='"&txtemailid&"'"

		                rsNewListMemberC.Open strSQLC, con3SQL

	                    If rsNewListMemberC.EOF Then

                            con3SQL.execute("Insert into tblMailingList(Email,ID_Code) values('"&txtemailid&"','"&strUserCode&"')")

					    End If

				    End If

				

				    rsNewListMember.Close

				    Set rsNewListMember = Nothing

				

							

		Next			

								

			

		'Set rsNewListMember1=Server.CreateObject("ADODB.Recordset")

		'strSQL1 = "SELECT Tourfee FROM tblTournament where TourID="&TID&";"

		'rsNewListMember1.Open strSQL1, conSQL

		

		' Are we charging a fee to register a tournament?

		

		'if rsNewListMember1("Tourfee") <> 0 then

		'url="thank.asp"

		'response.redirect(url)

		'else

		'On Error resume Next

								
 

			

		' clean up 

		set MyCDO=nothing

		url="thank.asp"

		response.redirect(url)

	end if 

	

%>

<html>

<head>

<title><%=PageTitle%></title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link href="../style/style.css" rel="stylesheet" type="text/css">

<script language="JavaScript">

function validate_all()

	{

		errmsg="";

	for(i=1;i<=document.regfrm.mcount.value;i++)

	{

		//errmsg +="Player"+i+"\n\n";

		if (eval("document.regfrm.txtfname"+i+".value")=="")

			errmsg +="Player"+i+" Firstname Field is Blank \n";

		if (eval("document.regfrm.txtaddr1"+i+".value")=="")

			errmsg +="Player"+i+ " Address Field is Blank \n";

		if (eval("document.regfrm.txtcity"+i+".value")=="")

			errmsg +="Player"+i+ " City Field is Blank \n";		

		if (eval("document.regfrm.txtstate"+i+".value")=="")

			errmsg +="Player"+i+ " State Field is Blank \n";

		if (eval("document.regfrm.txtpcode"+i+".value")=="")

			errmsg +="Player"+i+ " Zip Code Field is Blank \n";		

		if (eval("document.regfrm.txtcontactno"+i+".value")=="")

			errmsg +="Player"+i+ " Contact Number Field is Blank \n";		

		if (eval("document.regfrm.txtemailid"+i+".value")=="")

			errmsg +="Player"+i+ " Email ID Field is Blank \n";		

		else

		{

			var err=0

			mailid = eval("document.regfrm.txtemailid"+i+".value");

			val=mailid.indexOf("@");

			if (val!=-1)

			{

			  val1=mailid.indexOf(".");

			  if (val1==-1)

				err=1;	

			}  

			else

				err=1;

			

			if (err==1)

				  errmsg +="Player"+i+ " Invalid Email ID \n";

		}

 

		if (eval("document.regfrm.txthandicap"+i+".value")=="")

			errmsg +="Player"+i+ " Handicap Field is Blank \n";		

		if (eval("document.regfrm.txthomecourse"+i+".value")=="")

			errmsg +="Player"+i+ " Home Course Field is Blank \n";	

			

	}

	if (errmsg=="")         

	{

		return true;

	}

	else

	{

		alert(" Following Error Have Occured While Submiting This Form:\n\n"+errmsg);

		return false;

	}

}

 

function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}

 

function YY_checkform() { //v4.66

//copyright (c)1998,2002 Yaromat.com

  var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;

  for (var i=1; i<args.length;i=i+4){

    if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}

    var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));

    myV=myObj.value;

    if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){

      if (myReq&&myObj.value.length==0){addErr=true}

      if ((myV.length>0)&&(args[i+2]==1)){ //fromto

        var myMa=args[i+1].split('_');if(isNaN(myV)||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}

      } else if ((myV.length>0)&&(args[i+2]==2)){

          var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;

      } else if ((myV.length>0)&&(args[i+2]==3)){ // date

        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);

        if(myAt){

          var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];

          var myDate=new Date(myY,myM,myD);

          if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};

        }else{addErr=true}

      } else if ((myV.length>0)&&(args[i+2]==4)){ // time

        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}

      } else if (myV.length>0&&args[i+2]==5){ // check this 2

            var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));

            if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];

            if(!myObj1.checked){addErr=true}

      } else if (myV.length>0&&args[i+2]==6){ // the same

            var myObj1 = MM_findObj(args[i+1]);

            if(myV!=myObj1.value){addErr=true}

      }

    } else

    if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){

          var myTest = args[i].match(/(.*)\[(\d+)\].*/i);

          var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;

      if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}

      if (args[i+2]==2){

        var myDot=false;

        for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}

        if(!myDot){myErr+='* ' +args[i+3]+'\n'}

      }

    } else if (myObj.type=='checkbox'){

      if(args[i+2]==1&&myObj.checked==false){addErr=true}

      if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}

    } else if (myObj.type=='select-one'||myObj.type=='select-multiple'){

      if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}

    }else if (myObj.type=='textarea'){

      if(myV.length<args[i+1]){addErr=true}

    }

    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}

  }

  if (myErr!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr)}

  document.MM_returnValue = (myErr=='');

}

function MM_validateForm() { //v4.0

  if (document.getElementById){

    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;

    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);

      if (val) { nm=val.name; if ((val=val.value)!="") {

        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');

          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';

        } else if (test!='R') { num = parseFloat(val);

          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';

          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');

            min=test.substring(8,p); max=test.substring(p+1);

            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';

      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }

    } if (errors) alert('The following error(s) occurred:\n'+errors);

    document.MM_returnValue = (errors == '');

} }

</script>

 

 

<script language="JavaScript">

<!--

function isAlpha ( evt ) {

   var keyCode = evt.which ? evt.which : evt.keyCode;

   alpha = ( keyCode >= 'a'.charCodeAt ( ) &&

      keyCode <= 'z'.charCodeAt ( ) ) || 

      ( keyCode >= 'A'.charCodeAt ( ) &&

      keyCode <= 'Z'.charCodeAt ( ) ) || 

      ( keyCode >= 8 && keyCode <= 46 );

   return ( alpha );

}

 

function validateAlpha ( text ) {

   for ( c=0; c < text.length; c ++ ) {

      alpha = ( text.charCodeAt ( c ) >= 65 &&

         text.charCodeAt ( c ) <=90 ) || 

         ( text.charCodeAt ( c ) >= 97 &&

         text.charCodeAt ( c ) <=122 )

      if ( !alpha ) {

         alert ( 'No way, sorry.' );   

         document.theForm.theField.select ( );

         return false;

      }

   }

   return true;

}

//-->

</script>

 

 

 

</head>

<body background="<%=level%>images/bg.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="775" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr> 

    <td colspan="4" valign="top"><!--#include file="../include/header.asp"--></td>

  </tr>

  <tr>

    <td width="192" valign="top" bgcolor="#ffffff"><!-- #include file="../include/left.asp" --></td>

    <td width="591" valign="top" bgcolor="#ffffff">

      <form name="regfrm" method="post" action="" onSubmit="return validateNumber (this.theField.value )">

        <table width="88%" border="0" align="center" cellpadding="0" cellspacing="0" class="bodytxt1">

          <% if (msg<>"") then %>

          <tr> 

            <td width="100%" height="30" colspan="2" align="center" class="errortxt"><%=msg%></td>

          </tr>

          <% end if %>

        </table>

        <table width="423"  border="0" cellspacing="0" cellpadding="0" align="center" class="bodytxt1">

          <tr>

            <td width="28"><img src="<%=Level%>images/tbleft.jpg" width="28" height="24"></td>

            <td width="279" class="tableheader1">New User Sign Up &nbsp;for Tournament&nbsp;</td>

            <td width="116"><img src="<%=Level%>images/tbright.jpg" width="28" height="24"></td>

          </tr>

          <tr> 

            <td colspan="3" valign="top" bgcolor="#5eb020"> 

              <table width="100%"  border="0" cellspacing="1" cellpadding="0" class="bodytxt1" >

                <tr>

                  <td valign="top" bgcolor="#FFFFFF" class="tablebgcolor"><br>

                  Please Select the Tournament Members :

				  <select name="mcount" onChange="javascript:submit();">

				  <option value="1" <% if request.form("mcount")=1 then Response.write "selected" %>>1</option>

				  <option value="2" <% if request.form("mcount")=2 then Response.write "selected" %>>2</option>

				  <option value="3" <% if request.form("mcount")=3 then Response.write "selected" %>>3</option>

				  <option value="4" <% if request.form("mcount")=4 then Response.write "selected" %>>4</option>

				  <option value="5" <% if request.form("mcount")=5 then Response.write "selected" %>>5</option>

				  </select>

				   <br>

                  <br></td>

                </tr>

				<tr> 

                  <td valign="top" bgcolor="#FFFFFF" class="tablebgcolor"> 

				<%

				nct=request.form("mcount")

				'nct=play

				if nct="" then

				nct=1

				End if

				For i=1 to nct 

				%>

				<table width="100%" height="100%" align="center" cellpadding="5" cellspacing="0" class="bodytxt1" >

                      <tr align="left"> 

                        <td colspan="2" class="tableheader" >Player<%=i%> Personal Information                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Tournament Name</td>

                        <td width="60%"> <%=tourname%>                        </td>

                      </tr>

                      <tr>

                        <td align="right" >Team Name</td>

                        <td>  &nbsp;

                        <input name="txtteamname<%=i%>" type="text" class="txtbox1" id="txtteamname<%=i%>" onBlur="YY_checkform('regfrm','txtteamname<%=i%>2','#q','0','Field \'txtteamname<%=i%>2\' is not valid.');return document.MM_returnValue"  onKeyDown="

   if ( !isAlpha ( event ) ) {

      alert ( 'Please enter only letters on this field .' );

      return false;

   }" value="<%=request.form("txtteamname"&i)%>"  ></td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >First Name</td>

                        <td width="60%"> &nbsp; 

                          <input name="txtfname<%=i%>" type="text" class="txtbox1"  onKeyDown="

   if ( !isAlpha ( event ) ) {

      alert ( 'Please enter only letters on this field .' );

      return false;

   }" value=<%=request.form("txtteamname"&i)%> >                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Last Name</td>

                        <td width="60%"> &nbsp; 

                          <input type="text" name="txtlname<%=i%>" class="txtbox1"  onKeyDown="

   if ( !isAlpha ( event ) ) {

      alert ( 'Please enter only letters on this field .' );

      return false;

   }"

                           VALUE=<%=request.form("txtlname"&i)%> >                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Address</td>

                        <td width="60%"> &nbsp; 

                          <input type="text" name="txtaddr1<%=i%>" class="txtbox2" VALUE="<%=request.form("txtaddr1"&i)%>">                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right">Address</td>

                        <td width="60%"> &nbsp; 

                          <input type="text" name="txtaddr2<%=i%>" class="txtbox2" VALUE="<%=request.form("txtaddr2"&i)%>">                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >City </td>

                        <td width="60%"> &nbsp; 

                          <input type="text" name="txtcity<%=i%>" class="txtbox1"  onKeyDown="

   if ( !isAlpha ( event ) ) {

      alert ( 'Please enter only letters on this field .' );

      return false;

   }"

                           VALUE=<%=request.form("txcity"&i)%> >                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >State</td>

                        <td width="60%"> &nbsp; 

                        <select name="txtstate<%=i%>"class="txtbox1" 

                        value="<%=request.form("txtstate"&i)%>">

                            <option selected>--Choose a State--</option>

                            <option value="AL">Alabama</option>

                            <option value="AK">Alaska</option>

                            <option value="AZ">Arizona</option>

                            <option value="AR">Arkansas</option>

                            <option value="CA">California</option>

                            <option value="CO">Colorado</option>

                            <option value="CT">Connecticut</option>

                            <option value="DE">Delaware</option>

                            <option value="FL">Florida</option>

                            <option value="GA">Georgia</option>

                            <option value="HI">Hawaii</option>

                            <option value="ID">Idaho</option>

                            <option value="IL">Illinois</option>

                            <option value="IN">Indiana</option>

                            <option value="IA">Iowa</option>

                            <option value="KS">Kansas</option>

                            <option value="KY">Kentucky</option>

                            <option value="LA">Louisiana</option>

                            <option value="ME">Maine</option>

                            <option value="MD">Maryland</option>

                            <option value="MA">Massachusetts</option>

                            <option value="MI">Michigan</option>

                            <option value="MN">Minnesota</option>

                            <option value="MS">Mississippi</option>

                            <option value="MO">Missouri</option>

                            <option value="MT">Montana</option>

                            <option value="NE">Nebraska</option>

                            <option value="NV">Nevada</option>

                            <option value="NH">New Hampshire</option>

                            <option value="NJ">New Jersey</option>

                            <option value="NM">New Mexico</option>

                            <option value="NY">New York</option>

                            <option value="NF">Newfoundland</option>

                            <option value="NC">North Carolina</option>

                            <option value="ND">North Dakota</option>

                            <option value="OH">Ohio</option>

                            <option value="OK">Oklahoma</option>

                            <option value="OR">Oregon</option>

                            <option value="PA">Pennsylvania</option>

                            <option value="RI">Rhode Island</option>

                            <option value="SC">South Carolina</option>

                            <option value="SD">South Dakota</option>

                            <option value="TN">Tennessee</option>

                            <option value="TX">Texas</option>

                            <option value="UT">Utah</option>

                            <option value="VT">Vermont</option>

                            <option value="VA">Virginia</option>

                            <option value="WA">Washington</option>

                            <option value="DC">Washington, D.C.</option>

                            <option value="WV">West Virginia</option>

                            <option value="WI">Wisconsin</option>

                            <option value="WY">Wyoming</option>

                          </select>                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Zip Code</td>

                        <td width="60%"> &nbsp; 

                          <input name="txtpcode<%=i%>" type="text" class="txtbox1" tabindex="5" VALUE="<%=request.form("txtpcode"&i)%>" maxlength="5">                        </td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Contact Number</td>

                        <td width="60%"> &nbsp; 

                          <input name="txtcontactno<%=i%>" type="text" class="txtbox1" id="txtcontactno<%=i%>" onBlur="MM_validateForm('txtcontactno<%=i%>','','NisNum');return document.MM_returnValue" VALUE="<%=request.form("txtcontactno"&i)%>">                        </td>

                      </tr>

                      <tr>

                        

                        <td align="right" >Email Address</td>

                        <td>&nbsp;	<input NAME="txtemailid<%=i%>" type="text" class="combobox1" id="txtemailid<%=i%>" onBlur="YY_checkform('regfrm','txtemailid<%=i%>','#S','2','E-mail  is not valid. Please Enter a valid Email. ');return document.MM_returnValue" VALUE="<%=request.form("txtemailid"&i)%>"></td>

                      </tr>

                                  

                      <tr>

                        <td align="right" >Shirt Size </td>

                        <td> &nbsp; 

			<select name="txtshirtsize<%=i%>" width="3" VALUE="<%=request.form("txtshirtsize"&i)%>">

			  <option>Small</option>

			  <option>Medium</option>

			  <option>Large</option>

			  <option>X-Large</option>

			  <option>XX-Large</option>

			  <option>XXX-Large</option>

			  <option selected>--Choose a Size--</option>  

						</select>                    </td>

                      </tr>

                      <tr>

                        <td align="right" >Handicap </td>

                        <td> &nbsp; 

						<input type="text" name="txthandicap<%=i%>" class="combobox1" VALUE="<%=request.form("txthandicap"&i)%>"></td>

                      </tr>

                      <tr> 

                        <td width="40%" align="right" >Home Course </td>

                        <td width="60%"> &nbsp; 

						<select name="txthomecourse<%=i%>" class="combobox1">

                            <option value="">--Choose The Course--</option>

                            <%

							  set Rs_Course = conSQL.execute("select * from courses")

							  while Not Rs_Course.Eof 

								response.Write("<option value="&Rs_Course("CourseID")&">"&Rs_Course("Name")&"</option>")							  	

								Rs_Course.MoveNext

							  wend 

							  %>

                        </select>                        </td>

                      </tr>

					  <% 

					  If int(i)=int(nct) Then %>

                      <tr align="center" > 

                        <td colspan="2" > 

						                          <input type="hidden" name="tourname" value="<%=tourname%>">

						   <input type="hidden" name="TID" value=<%=TID%>>

 

                          <input type="submit" name="Submit" value="Submit" class="button1" onClick="return validate_all()">

                          <input type="reset" name="Submit2" value="Reset" class="button1">                        </td>

                      </tr>

					  <% End If %>

                    </table>

               <%

			   Next

			   %>

                  </td>

				</tr>

              </table>

            </td>

          </tr>

        </table>

        <br>

        <br>

      </form>    </td>

    <td width="1" valign="top" bgcolor="#285E8E"></td>

    <!--

    <td width="161" valign="top" bgcolor="#FFFFFF"> 

      <!--include file="../include/right.asp"

    </td> -->

    

    

  </tr>

  <tr> 

    <td colspan="4">

      <!--#include file="../include/footer.asp"-->

    </td>

  </tr>

</table>

</body>

</html>

Open in new window

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now