Link to home
Start Free TrialLog in
Avatar of ms_saro
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")="True" 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">MasterCard</option>
        <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 &amp;Conditions set by the conference</td>
</tr>
<tr>
  <td>
    <input type="submit" name="Submit" value="Submit">
  </td>
  <td>&nbsp;</td>
</tr>
</table>
</form>


<script language="JavaScript">
<!--
document.form1.textfield6.focus();

function validateCCNum(cardType,ccNum)
{
    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.textfield6.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.value == "") {
alert("You must enter a Name");
document.form1.address.focus();
return false;
}

var checkname=document.form1.address.value;
if (checkname.length<10)
{
  alert("Address should be at least 10 characters");

document.form1.address.focus();
return false;
}


if (document.form1.postcode.value == "") {
alert("You must enter a  post code number.");
document.form1.postcode.focus();
return false;
}

// only allow numbers to be entered for post code
var checkOK = "0123456789";
var checkStr = document.form1.postcode.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 post code number.");
document.form1.postcode.focus();
return (false);
}


if (document.form1.phone.value == "") {
alert("Please input a phone number");
document.form1.phone.focus();
return false;
}
// only allow alphanumeric
var checkOK = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
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.value == "") {
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.value
var ccNum = document.form1.ccNum.value;
if (!validateCCNum(ccType,ccNum)){
alert ("Please make sure that you enter " + errormsg);
document.form1.ccNum.focus();
return false;
}
//==========

if (document.form1.checkbox.checked == false) {

alert("You must must agree with the term and condition.");
//document.form1.checkbox.focus();
return false;
}
document.form1.form_ok.value="True";
return true;
}
// -->
</script>

</body>
</html>
Avatar of hongjun
hongjun
Flag of Singapore image

In your gladx.asp, you will do the emailing.

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") & vbcrlf & _
          "Age = " & request.form("textfield5")

Set objMailer = CreateObject("CDONTS.Newmail")
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
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
Avatar of gladxml
gladxml

Avatar of ms_saro

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
Avatar of ms_saro

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
ASKER CERTIFIED SOLUTION
Avatar of hongjun
hongjun
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ms_saro, this area is the right one to post such questions.

hongjun
BTW I forgot to tell you put here your email part but dont forget this part
>>>>>if request.form("form_ok")="True" then<<<<

so that on the first loading the page will ignore the asp script...

<%

if request.form("form_ok")="True" 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...
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...


Avatar of ms_saro

ASKER

lol glad.. there is a question waiting for u.. point to glad..