ms_saro
asked on
saro needs ur help
i'm developing a website.. and there is a registration form that should be filled by the user.. then a confirmation email should be sent to this user....
after the user enters and fills the registration form and all his entries are checked for validation. then data from the form will be sent as an email .. (registration info) will be part of the message of the email..
how to post what he enters in the message and then how to do the email thing.. !?!??!!?
plz refer to my form..(below).. to make it easier for me to understand the concept of the email and this senario
<%
if request.form("form_ok")="T rue" then
response.write request.form("textfield6") & "<br>"
response.write request.form("textfield5") & "<br>"
response.write request.form("ccType") & "<br>"
response.write request.form("ccNum") & "<br>"
end if
%>
<html>
<head>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="gladx.asp" onSubmit="return Valid_Personal()" >
<input type="hidden" name="form_ok" value="False">
<table width="75%" border="1">
<tr>
<td>Name</td>
<td>
<input type="text" name="textfield6">
</td>
</tr>
<tr>
<td>Age</td>
<td>
<input type="text" name="textfield5">
</td>
</tr>
<tr>
<td>Address</td>
<td>
<input type="text" name="address">
</td>
</tr>
<tr>
<td>Post Code</td>
<td>
<input type="text" name="postcode">
</td>
</tr>
<tr>
<td>Phone Number</td>
<td>
<input type="text" name="phone">
</td>
</tr>
<tr>
<td>Credit Card Type</td>
<td>
<select name="ccType">
<option value="VISA" selected>Visa</option>
<option value="MASTERCARD">MasterC ard</optio n>
<option value="AMEX">AMEX</option>
</select>
</td>
</tr>
<tr>
<td>Credit Card Number</td>
<td>
<input type="text" name="ccNum">
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="checkbox">
</td>
<td>I Agree to Terms &Conditions set by the conference</td>
</tr>
<tr>
<td>
<input type="submit" name="Submit" value="Submit">
</td>
<td> </td>
</tr>
</table>
</form>
<script language="JavaScript">
<!--
document.form1.textfield6. focus();
function validateCCNum(cardType,ccN um)
{
var result = false;
cardType = cardType.toUpperCase();
var cardLen = ccNum.length;
switch (cardType)
{
case "VISA":
result = (cardLen == 16);
errormsg = "16 digit number for VISA credit card";
break;
case "AMEX":
result = (cardLen == 15);
errormsg = "15 digit number for AMEX credit card";
break;
case "MASTERCARD":
result = (cardLen == 16);
errormsg = "16 digit number for MASTERCARD credit card";
break;
}
return result;
}
function Valid_Personal(obj)
{
if (document.form1.textfield6 .value == "") {
alert("You must enter a Name");
document.form1.textfield6. focus();
return false;
}
var checkname=document.form1.t extfield6. value;
if (checkname.length<4)
{
alert("Name should be at least 40 characters");
document.form1.textfield6. focus();
return false;
}
if (document.form1.textfield5 .value == "") {
alert("You must enter an Age");
document.form1.textfield5. focus();
return false;
}
// only allow numbers to be entered
var checkOK = "0123456789";
var checkStr = document.form1.textfield5. value;
var allValid = true;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (allNum<0 || allNum>99)
allValid=false;
if (!allValid)
{
alert("Please enter a valid age.");
document.form1.textfield5. focus();
return (false);
}
if (document.form1.textfield5 .value < 18) {
alert("You must be 18 year and above.");
document.form1.textfield5. focus();
return false;
}
if (document.form1.address.va lue == "") {
alert("You must enter a Name");
document.form1.address.foc us();
return false;
}
var checkname=document.form1.a ddress.val ue;
if (checkname.length<10)
{
alert("Address should be at least 10 characters");
document.form1.address.foc us();
return false;
}
if (document.form1.postcode.v alue == "") {
alert("You must enter a post code number.");
document.form1.postcode.fo cus();
return false;
}
// only allow numbers to be entered for post code
var checkOK = "0123456789";
var checkStr = document.form1.postcode.va lue;
var allValid = true;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter a valid post code number.");
document.form1.postcode.fo cus();
return (false);
}
if (document.form1.phone.valu e == "") {
alert("Please input a phone number");
document.form1.phone.focus ();
return false;
}
// only allow alphanumeric
var checkOK = "0123456789ABCDEFGHIJKLMNO PQRSTUVWXY Z";
var checkStr = document.form1.phone.value ;
var allValid = true;
var allNum = "";
//remark the below lines if it is case sensetive...
checkStr = checkStr.toUpperCase();
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter a valid alphanumeric number.");
document.form1.phone.focus ();
return (false);
}
var checkphone = document.form1.phone.value ;
if (checkphone.length < 7) {
alert("Phone number must be at least 7 digits");
document.form1.phone.focus ();
return false;
}
if (document.form1.ccNum.valu e == "") {
alert("You must enter a Credit card number.");
document.form1.ccNum.focus ();
return false;
}
// only allow numbers to be entered
var checkOK = "0123456789";
var checkStr = document.form1.ccNum.value ;
var allValid = true;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter a valid Credit card number.");
document.form1.ccNum.focus ();
return (false);
}
//========== check for credit type if valid
var result = true;
var ccType = document.form1.ccType.valu e
var ccNum = document.form1.ccNum.value ;
if (!validateCCNum(ccType,ccN um)){
alert ("Please make sure that you enter " + errormsg);
document.form1.ccNum.focus ();
return false;
}
//==========
if (document.form1.checkbox.c hecked == false) {
alert("You must must agree with the term and condition.");
//document.form1.checkbox. focus();
return false;
}
document.form1.form_ok.val ue="True";
return true;
}
// -->
</script>
</body>
</html>
after the user enters and fills the registration form and all his entries are checked for validation. then data from the form will be sent as an email .. (registration info) will be part of the message of the email..
how to post what he enters in the message and then how to do the email thing.. !?!??!!?
plz refer to my form..(below).. to make it easier for me to understand the concept of the email and this senario
<%
if request.form("form_ok")="T
response.write request.form("textfield6")
response.write request.form("textfield5")
response.write request.form("ccType") & "<br>"
response.write request.form("ccNum") & "<br>"
end if
%>
<html>
<head>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="gladx.asp" onSubmit="return Valid_Personal()" >
<input type="hidden" name="form_ok" value="False">
<table width="75%" border="1">
<tr>
<td>Name</td>
<td>
<input type="text" name="textfield6">
</td>
</tr>
<tr>
<td>Age</td>
<td>
<input type="text" name="textfield5">
</td>
</tr>
<tr>
<td>Address</td>
<td>
<input type="text" name="address">
</td>
</tr>
<tr>
<td>Post Code</td>
<td>
<input type="text" name="postcode">
</td>
</tr>
<tr>
<td>Phone Number</td>
<td>
<input type="text" name="phone">
</td>
</tr>
<tr>
<td>Credit Card Type</td>
<td>
<select name="ccType">
<option value="VISA" selected>Visa</option>
<option value="MASTERCARD">MasterC
<option value="AMEX">AMEX</option>
</select>
</td>
</tr>
<tr>
<td>Credit Card Number</td>
<td>
<input type="text" name="ccNum">
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="checkbox">
</td>
<td>I Agree to Terms &Conditions set by the conference</td>
</tr>
<tr>
<td>
<input type="submit" name="Submit" value="Submit">
</td>
<td> </td>
</tr>
</table>
</form>
<script language="JavaScript">
<!--
document.form1.textfield6.
function validateCCNum(cardType,ccN
{
var result = false;
cardType = cardType.toUpperCase();
var cardLen = ccNum.length;
switch (cardType)
{
case "VISA":
result = (cardLen == 16);
errormsg = "16 digit number for VISA credit card";
break;
case "AMEX":
result = (cardLen == 15);
errormsg = "15 digit number for AMEX credit card";
break;
case "MASTERCARD":
result = (cardLen == 16);
errormsg = "16 digit number for MASTERCARD credit card";
break;
}
return result;
}
function Valid_Personal(obj)
{
if (document.form1.textfield6
alert("You must enter a Name");
document.form1.textfield6.
return false;
}
var checkname=document.form1.t
if (checkname.length<4)
{
alert("Name should be at least 40 characters");
document.form1.textfield6.
return false;
}
if (document.form1.textfield5
alert("You must enter an Age");
document.form1.textfield5.
return false;
}
// only allow numbers to be entered
var checkOK = "0123456789";
var checkStr = document.form1.textfield5.
var allValid = true;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (allNum<0 || allNum>99)
allValid=false;
if (!allValid)
{
alert("Please enter a valid age.");
document.form1.textfield5.
return (false);
}
if (document.form1.textfield5
alert("You must be 18 year and above.");
document.form1.textfield5.
return false;
}
if (document.form1.address.va
alert("You must enter a Name");
document.form1.address.foc
return false;
}
var checkname=document.form1.a
if (checkname.length<10)
{
alert("Address should be at least 10 characters");
document.form1.address.foc
return false;
}
if (document.form1.postcode.v
alert("You must enter a post code number.");
document.form1.postcode.fo
return false;
}
// only allow numbers to be entered for post code
var checkOK = "0123456789";
var checkStr = document.form1.postcode.va
var allValid = true;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter a valid post code number.");
document.form1.postcode.fo
return (false);
}
if (document.form1.phone.valu
alert("Please input a phone number");
document.form1.phone.focus
return false;
}
// only allow alphanumeric
var checkOK = "0123456789ABCDEFGHIJKLMNO
var checkStr = document.form1.phone.value
var allValid = true;
var allNum = "";
//remark the below lines if it is case sensetive...
checkStr = checkStr.toUpperCase();
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter a valid alphanumeric number.");
document.form1.phone.focus
return (false);
}
var checkphone = document.form1.phone.value
if (checkphone.length < 7) {
alert("Phone number must be at least 7 digits");
document.form1.phone.focus
return false;
}
if (document.form1.ccNum.valu
alert("You must enter a Credit card number.");
document.form1.ccNum.focus
return false;
}
// only allow numbers to be entered
var checkOK = "0123456789";
var checkStr = document.form1.ccNum.value
var allValid = true;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter a valid Credit card number.");
document.form1.ccNum.focus
return (false);
}
//========== check for credit type if valid
var result = true;
var ccType = document.form1.ccType.valu
var ccNum = document.form1.ccNum.value
if (!validateCCNum(ccType,ccN
alert ("Please make sure that you enter " + errormsg);
document.form1.ccNum.focus
return false;
}
//==========
if (document.form1.checkbox.c
alert("You must must agree with the term and condition.");
//document.form1.checkbox.
return false;
}
document.form1.form_ok.val
return true;
}
// -->
</script>
</body>
</html>
See this for more information on CDONTS.
http://msdn.microsoft.com/library/psdk/cdo/_denali_newmail_object_cdonts_library_.htm
If you do not have IIS because you are not running ntfs partition, then you will need to download a web server and I recommend you using Personal Web Server (PWS). Download it at http://www.microsoft.com/ntserver/nts/downloads/recommended/nt4optpk/default.asp. Note that PWS will not be able to support CDONTS.
If you are using other versions of Windows, then you got to install a server component. I recommend using AspEmail. It can be downloaded from http://www.aspemail.com
To learn how to code using the AspEmail component, you can download its user manual from the site itself. It is very comprehensive and complete. There's even an asp example page showing that.
Other available components
Genusa's AspMail
http://www.serverobjects.com/products.htm#Aspmail
ASPEmail
http://www.aspemail.com/
Dundas Mailer
http://www.dundas.com/index.asp?/products/mailer
MailListBot
http://www.MailListBot.com/
EasyMail
http://www.easymailobjects.com/emobjects/smtp.asp
w3 Jmail
http://www.dimac.net/
HTMLMailer / HTMLMailerPlus
http://www.oopadelic.com/htmlmailer/
http://www.oopadelic.com/htmlmailerplus/
DevMailer
http://www.geocel.com/devmailer/
VSEmail
http://www.vsoft-tech.com.au/vsemail/readme.html
Mabry Mail
http://www.mabry.com/mail/index.htm
NNTPClient+SMTPClient
http://www.liquidcool.com/asp
SimpleMail
http://www.adiscon.com/SimpleMail
AB Active X Mailer
http://www.geocities.com/ResearchTriangle/2656/abmailer.html
OCXMail
http://www.flicks.com/aspmail/
WindMail
http://www.geocel.com/windmail/
Zaks.POP3
http://www.zaks.demon.co.uk/code/cpts/pop/index.html
Good Luck
hongjun
http://msdn.microsoft.com/library/psdk/cdo/_denali_newmail_object_cdonts_library_.htm
If you do not have IIS because you are not running ntfs partition, then you will need to download a web server and I recommend you using Personal Web Server (PWS). Download it at http://www.microsoft.com/ntserver/nts/downloads/recommended/nt4optpk/default.asp. Note that PWS will not be able to support CDONTS.
If you are using other versions of Windows, then you got to install a server component. I recommend using AspEmail. It can be downloaded from http://www.aspemail.com
To learn how to code using the AspEmail component, you can download its user manual from the site itself. It is very comprehensive and complete. There's even an asp example page showing that.
Other available components
Genusa's AspMail
http://www.serverobjects.com/products.htm#Aspmail
ASPEmail
http://www.aspemail.com/
Dundas Mailer
http://www.dundas.com/index.asp?/products/mailer
MailListBot
http://www.MailListBot.com/
EasyMail
http://www.easymailobjects.com/emobjects/smtp.asp
w3 Jmail
http://www.dimac.net/
HTMLMailer / HTMLMailerPlus
http://www.oopadelic.com/htmlmailer/
http://www.oopadelic.com/htmlmailerplus/
DevMailer
http://www.geocel.com/devmailer/
VSEmail
http://www.vsoft-tech.com.au/vsemail/readme.html
Mabry Mail
http://www.mabry.com/mail/index.htm
NNTPClient+SMTPClient
http://www.liquidcool.com/asp
SimpleMail
http://www.adiscon.com/SimpleMail
AB Active X Mailer
http://www.geocities.com/ResearchTriangle/2656/abmailer.html
OCXMail
http://www.flicks.com/aspmail/
WindMail
http://www.geocel.com/windmail/
Zaks.POP3
http://www.zaks.demon.co.uk/code/cpts/pop/index.html
Good Luck
hongjun
ms_saro,
The codes looks familiar...
You can also try this link...
http://www.4guysfromrolla.com/webtech/043000-1.shtml
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=6422
http://nuts4asp.com/scrips/slog/
HTH...
Happy programming...
The codes looks familiar...
You can also try this link...
http://www.4guysfromrolla.com/webtech/043000-1.shtml
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=6422
http://nuts4asp.com/scrips/slog/
HTH...
Happy programming...
ASKER
ok one more thing..
how to send this email 2
objMailer.To = "receipent@domain.com" <---- using what the user's enters in the email address textfield & what if i want to send it to the user's email and to my email.. ??
do u have a proper way of presenting these info.. i mean a nice layout :S
i've added 50 points
how to send this email 2
objMailer.To = "receipent@domain.com" <---- using what the user's enters in the email address textfield & what if i want to send it to the user's email and to my email.. ??
do u have a proper way of presenting these info.. i mean a nice layout :S
i've added 50 points
ASKER
lol yes galdx..can't u see ur name in it.. but someone advised me to post it in the java script forum..but unfortunatelly i've been waiting for 3 days and no response from them.. that's why i'm back here again..
Saroosh
Saroosh
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ms_saro, this area is the right one to post such questions.
hongjun
hongjun
BTW I forgot to tell you put here your email part but dont forget this part
>>>>>if request.form("form_ok")="T rue" then<<<<
so that on the first loading the page will ignore the asp script...
<%
if request.form("form_ok")="T rue" then
'put here your emailing part
end if
%>
This link will teach the step by step process...
http://www.4guysfromrolla.com/webtech/043000-1.shtml
HTH...
Happy programming...
>>>>>if request.form("form_ok")="T
so that on the first loading the page will ignore the asp script...
<%
if request.form("form_ok")="T
'put here your emailing part
end if
%>
This link will teach the step by step process...
http://www.4guysfromrolla.com/webtech/043000-1.shtml
HTH...
Happy programming...
ms_saro,
If you are asking of javascript then post your code on the javascript forum... That what i mean...
but if it is regarding asp post your code here in asp forum..
Good to have you back...
BTW why do change your name...
Happy programming...
If you are asking of javascript then post your code on the javascript forum... That what i mean...
but if it is regarding asp post your code here in asp forum..
Good to have you back...
BTW why do change your name...
Happy programming...
ASKER
lol glad.. there is a question waiting for u.. point to glad..
If you are using Win NT or Win 2000 and have CDONTS.dll installed, then you can do the following using Internt Information Server (IIS) as your web server.
<%
Dim objMailer
Dim strBody
' You can have HTML tags here
' You can therefore customize the format you want to send
' add more fields to send accordingly
strBody = "Name = " & request.form("textfield6")
"Age = " & request.form("textfield5")
Set objMailer = CreateObject("CDONTS.Newma
objMailer.From = "sender@domain.com"
objMailer.To = "receipent@domain.com"
objMailer.Subject = "Your subject here"
objMailer.BodyFormat = 0
objMailer.Mailformat = 0
objMailer.Body = strBody
objMailer.Send
Set objMailer = Nothing
%>
hongjun