[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.8

send email out then submit is clicked and checkbox is checked?

Asked by pigmentarts in Programming for ASP.NET

Tags: postcode, requiredfieldvalidator, dim

My webpage sends email out then submit is clicked, I need it to only send out a email if one of the check boxes on the form has been checked when submited

How can I do this.  

my code is below

________________


<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Web.Mail" %>

<script language="VB" runat="server">
            
             Sub Submit_Click(Sender as Object, e as EventArgs)
             Dim cnn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath("cl.mdb"))
        Dim cmd As New OleDb.OleDbCommand

          Page.Validate
If Page.IsValid Then
        cmd.CommandText = "INSERT INTO members (title, first_name, last_name, company_name, house_number_name, street, address1, address2, town, postcode, telephone, fax, email, pass, web_address, sector, no_employees, hear_about_us, callback, keep_todate) VALUES ('" & title.Value  & "', '" & first_name.Value  & "', '" & last_name.Value  & "', '" & company_name.Value  & "', '" & house_number_name.Value  & "', '" & street.Value  & "', '" & address1.Value  & "', '" & address2.Value  & "', '" & town.Value  & "', '" & postcode.Value  & "', '" & telephone.Value  & "', '" & fax.Value  & "', '" & email.Value  & "', '" & pass.Value  & "', '" & web_address.Value  & "', '" & sector.Value  & "', '" & no_employees.Value  & "', '" & hear_about_us.Value  & "', '" & callback.checked & "', '" & keep_todate.checked & "')"

        cmd.Connection = cnn

        cnn.Open()
        cmd.ExecuteNonQuery()
        cnn.Close()

        cmd.Dispose()
        cnn.Dispose()
            
            
    If request.form("email") <> ""
      
        Dim mail As New MailMessage
        mail.From = request.form ("email")
        mail.To = "glynj@pcdi.co.uk"
        mail.Subject = "Request for call back"
        mail.Body = "User submitted a request for call back using the online registration form." & "<br>" & "Client Name: " & request.Form("first_name") & " " & request.Form("last_name") & "<br>" & "Telephone number recorded: " & request.form ("telephone") & "<br> Email powered by webwordz"
        mail.BodyFormat = MailFormat.Html
               SmtpMail.SmtpServer = "10.0.0.2"
            SmtpMail.Send(mail)
            
            
            Dim mail2 As New MailMessage
        mail2.From = "somewhere"
        mail2.To = request.Form("email")
        mail2.Subject = "Thank you for registering"
        mail2.Body = "User submitted a request for call back using the online registration form."
        mail2.BodyFormat = MailFormat.Html
               SmtpMail.SmtpServer = "10.0.0.2"
            SmtpMail.Send(mail2)
             
    End If

          Response.Redirect("thankyou.html")
Else
'Do Whatever
End IF
     
     end sub


      
      </script>
      
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/mainTemplate.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="quotes.js"></SCRIPT>

<script>
function quotePrint()
{
var index = parseInt(Math.random()*Quotes.length)

return(Quotes[index])
}

</script>
      <!-- InstanceBeginEditable name="doctitle" -->
      <title>Register Page</title>
      <!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <!-- InstanceBeginEditable name="head" -->
      <style type="text/css">
<!--
.style6 {font-size: 9px}
-->
    </style>
      <!-- InstanceEndEditable -->
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
      font-size: 16px;
      font-weight: bold;
}
.style4 {font-size: 14px}
.style5 {font-size: 14px; font-weight: bold; }
-->
</style>
</head>
<body>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
      <tr>
            <td style="width: 5%; background: #EEE; border-right: 1px solid #AAA;">&nbsp;</td>
            <td>
            <div class="londonLandscape">
                  <a href="index.html" target="_self"><img src="images/logo.gif" alt="Connecting London Logo" border="0" align="left" style="margin-right: 10px; "></a>
                  <img src="images/londonpic.jpg" alt="Connecting London Logo" align="right">
              <div style="padding-top: 15px; "><br />
                  <span class="textSize style1"><span class="textSize style4">Information - Communications - Technology</span></span><span class="style5"></span><span class="style1"><br />
               </span>              <span class="blueText">We support you...</span></div>
              <span class="blueText">not just your systems!</span></div>
            </div>
            <div id="topmenu1">
                <div style="float:right; "><a href="aboutus.html" target="_self">about us</a> | <a href="contactus.html" target="_self">contact us</a> | <a href="legal.html"> legal</a> | <a href="careers.html" target="_self">careers</a> | <a href="sitemap.html" target="_self">sitemap</a></div>
                         <!-- InstanceBeginEditable name="stat" -->home&gt;register<!-- InstanceEndEditable -->
            </div>
            <div style="clear: both; margin-top: 20px;">
                  <div class="box3">
                  <div class="specialOfferBox">
                  <div class="smallTitle" style="color:#FF0000; font-size: 12px;">Special Offer This Month</div>
            </div>
            <div class="graybox">
                  <center><b>
                  <p>EMAIL PROTECTION AGENCY (EPA) SPAM PROTECTION FOR BUSINESS:</p>
                  <p class="FreeTrial"> FREE 15-DAY TRIAL</p>
                  <p>EPA Spam Potection is <br>
                    available to registered <br>
                    Connecting London <br>
                members FREE for 15 days.</p>
                  </b>
                    <p>members click here <a href="membercheck.aspx">click here</a>.
                  <p class="textSize">If you are not a Connecting London member, and would like to apply for membership please register <span class="redlink"><a href="register.aspx">click here
                  </a></span><br>
                  <br>There's no charge for joining, and you do not have to be an existing client.</p>
                  </center>
            </div>
            <div class="smallTitle">Our business partners</div>
                  <div class="graybox" align="center">
                    <img src="images/logos.jpg" alt="logos">
            </div>
      </div>
<div class="box1">
            <div id="nav" style="padding-bottom: 30px; ">
                  <ul class="level1">
                  <li><a href="index.html"><strong>Home</strong></a></li>
                  <li><a href="private_clients .html"><strong>Private Client Computing</strong></a></li>
                  <li class="submenu"><a href="corporate_client_computing.html"><strong>Corporate Client Computing </strong></a>
                   <ul class="level2">
                   <li><a href="corporate_client_consultancy.html">Consultancy</a></li>
                  <li><a href="/">Networks</a></li>
                  <li><a href="/">Computer Services</a></li>
                  <li><a href="communications_services.html">Communications Services </a></li>
                  <li><a href="internet_services.html">Internet Services</a></li>
                  <li><a href="training_and_familiarisation.html">Training</a></li>
                  <li><a href="service_and_maintenance.html">Service and Maintenance</a></li>
                  <li><a href="/">Financing</a></li>
             </ul>
            </li>
            <li><a href="computer_systems_maintenance_service_and_support.html"><strong>Service & Maintenance</strong></a></li>
            <li><a href="case_histories.html"><strong>Case Histories</strong></a></li>
              <li><a href="customer_charter.html"><strong>Customer Charter</strong></a></li>
        </ul>
</div>
<div class="smallTitle" align="right">Members Email Login</div>
      <div class="graybox"><form method="post" action="membercheck.aspx">
      <center>
      
      


      User Name
      <input name="username" type="text">
      Password
      <input name="password" type="password">
      <br>
      <div align="right">
      <input name="Login" type="submit" value="Login">
      
      </div>
      </center></form>
      If you are a registered member and want to access the members area please <a href="membercheck.aspx">click here</a>      </div>
      <div class="smallTitle" align="right">What our clients say about us</div>
      <div class="graybox">
            <script>document.write(quotePrint())</script>
      </div>
</div>
      <div class="box2">
            <!-- InstanceBeginEditable name="content" -->
            <div class="graybar"><img src="images/headings/register.gif" alt="corporate client image"></div>
            <p>Welcome to connecting London's registration page. Please fill in the entire form below to register with us. All fields in <b>bold</b> are mandatory.</p>  
            
            <form runat="server">
<table width="auto"  border="0" align="left" cellpadding="5" cellspacing="0">
  <tr>
    <td bgcolor="#F7F7F7"><div align="right"><b>Title:</b></div></td>
    <td bgcolor="#F7F7F7"><div align="left">
      <input name="text" type="text" id="title" value="" runat="server">
    </div></td>
    <td><div align="left">
      <asp:RequiredFieldValidator runat=server
            ControlToValidate=title
            ErrorMessage=""> * </asp:RequiredFieldValidator>
    </div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right"><b>First Name:</b></div></td>
    <td bgcolor="#F7F7F7">
        <div align="left">
          <input type="text" ID="first_name" value="" runat="server">
          </div></td>
    <td><div align="left">
      <asp:RequiredFieldValidator runat=server
            ControlToValidate=first_name
            ErrorMessage=""> * </asp:RequiredFieldValidator>
    </div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right"><b>Last Name:</b></div></td>
    <td bgcolor="#F7F7F7">
        <div align="left">
          <input type="text" ID="last_name" value="" runat="server">
          </div></td>
    <td><div align="left">
      <asp:RequiredFieldValidator runat=server
            ControlToValidate=last_name
            ErrorMessage=""> * </asp:RequiredFieldValidator>
       </div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right">Company Name:</div></td>
    <td bgcolor="#F7F7F7">
        <div align="left">
          <input type="text" ID="company_name" value="" runat="server">
          </div></td>
    <td>
       <div align="left"></div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right"><b>Address Number/Name:</b></div></td>
    <td bgcolor="#F7F7F7">
        <div align="left">
          <input type="text" ID="house_number_name" value="" runat="server">
          </div></td>
    <td><div align="left">
      <asp:RequiredFieldValidator runat=server
            ControlToValidate=house_number_name
            ErrorMessage=""> * </asp:RequiredFieldValidator>
        </div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right"><b>Street</b></div></td>
    <td bgcolor="#F7F7F7">
        <div align="left">
          <input type="text" ID="street" value="" runat="server">
          </div></td>
    <td><div align="left">
      <asp:RequiredFieldValidator runat=server
            ControlToValidate=street
            ErrorMessage=""> * </asp:RequiredFieldValidator>
        </div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right"><b>Address 1:</b></div></td>
    <td bgcolor="#F7F7F7">
        <div align="left">
          <input type="text" ID="address1" value="" runat="server">
          </div></td>
    <td><div align="left">
      <asp:RequiredFieldValidator runat=server
            ControlToValidate=address1
            ErrorMessage=""> * </asp:RequiredFieldValidator>
        </div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right">Address 2:</div></td>
    <td bgcolor="#F7F7F7">
        <div align="left">
          <input type="text" ID="address2" value="" runat="server">
          </div></td>
    <td>
        <div align="left"></div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right"><b>Town:</b></div></td>
    <td bgcolor="#F7F7F7">
        <div align="left">
          <input type="text" ID="town" value="" runat="server">
          </div></td>
    <td><div align="left">
      <asp:RequiredFieldValidator runat=server
            ControlToValidate=town
            ErrorMessage=""> * </asp:RequiredFieldValidator>
        </div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right"><b>PostCode:</b></div></td>
    <td bgcolor="#F7F7F7">
        <div align="left">
          <input type="text" ID="postcode" value="" runat="server">
          </div></td>
    <td><div align="left">
      <asp:RequiredFieldValidator runat=server
            ControlToValidate=postcode
            ErrorMessage=""> * </asp:RequiredFieldValidator>
        </div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right"><b>Telephone:</b></div></td>
    <td bgcolor="#F7F7F7">  
        <div align="left">
          <input type="text" ID="telephone" value="" runat="server">
          </div></td>
            
    <td><div align="left">
      <asp:RequiredFieldValidator runat=server
            ControlToValidate=telephone
            ErrorMessage=""> * </asp:RequiredFieldValidator>
                    
                  <asp:RegularExpressionValidator runat=server display=dynamic
            ControlToValidate="telephone"
            ErrorMessage="Tel must be 8 12 nonblank characters."
            ValidationExpression="[^\s]{4,12}"/>            
 

     </div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right">Fax Number:</div></td>
    <td bgcolor="#F7F7F7">
        <div align="left">
          <input type="text" ID="fax" value="" runat="server">
          </div></td>
    <td>
       <div align="left"></div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right"><b>Email Address</b></div></td>
    <td bgcolor="#F7F7F7">
        <div align="left">
          <input type="text" ID="email" value="" runat="server">
          </div></td>
    <td>
       <div align="left"><asp:RegularExpressionValidator id="valRegEx" runat="server"
    ControlToValidate="email"
    ValidationExpression=".*@.*\..*"
    ErrorMessage="Your entry is not a valid e-mail address."
    display="dynamic">*
</asp:RegularExpressionValidator></div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right"><b>Password:</b></div></td>
    <td bgcolor="#F7F7F7">
        <div align="left">
          <input type="password" ID="pass" value="" runat="server">
          </div></td>
    <td><div align="left">
      <asp:RequiredFieldValidator runat=server
            ControlToValidate=pass
            ErrorMessage=""> * </asp:RequiredFieldValidator>
            
                  
                              
       
     </div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right">Re-type Password</div></td>
    <td bgcolor="#F7F7F7"><div align="left">
      <input type="password" ID="passcheck" value="" runat="server">
    </div></td>
    <td><div align="left">
      <asp:CompareValidator runat=server
            controltovalidate=pass
            controltocompare=passcheck
            errormessage="Passwords do not match." />    
</div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right">Web Address:</div></td>
    <td bgcolor="#F7F7F7">  
        <div align="left">
          <input type="text" ID="web_address" value="" runat="server">
          </div></td>
    <td>
      <div align="left"></div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right">Business Sector:</div></td>
    <td bgcolor="#F7F7F7">      
        <div align="left">
            <select id="sector" runat="server">
                                <option value="None Selected">Select</option>
                      <option value="Automotive">Automotive</option>
                      <option value="Computers">Computers</option>  
                      <option value="Construction">Construction</option>
                              <option value="Consumer Goods">Consumer Goods</option>
                              <option value="Education">Education</option>
                              <option value="Electronics">Electronics</option>
                              <option value="Entertainment">Entertainment</option>
                              <option value="Financial Institution">Financial Institution</option>
                              <option value="Insurance">/Insurance</option>
                              <option value="Other">/Other</option>
                              <option value="Government">Government</option>
                              <option value="Military">Military</option>
                              <option value="Public Sector">Public Sector</option>
                              <option value="Hospitality">Hospitality</option>
                              <option value="Recreation">Recreation</option>
                              <option value="Leisure Industry">Leisure Industry</option>
                              <option value="Manugacturer">Manugacturer</option>
                              <option value="Media">Media</option>
                              <option value="Medical">Medical</option>
                              <option value="Health Services">Health Services</option>
                              <option value="Pharmaceuticals">Pharmaceuticals</option>
                              <option value="Professional Services">Professional Services</option>
                              <option value="Publishers">Publishers</option>
                              <option value="Retail">Retail</option>
                              <option value="Telecommunications">Telecommunications</option>
                              <option value="Travel">Travel</option>
                              <option value="Transportation">Computers</option>
            </select>
          </div></td>
    <td>
      <div align="left"></div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right">No. Employees:</div></td>
    <td bgcolor="#F7F7F7">    
        <div align="left">
            <select id="no_employees" runat="server">
                                <option value="None Selected">Select</option>
                      <option>1-10</option>
                      <option>11-25</option>  
                      <option>26-50</option>  
                      <option>50+</option>  
            </select>
          </div></td>
    <td>
      <div align="left"></div></td>
  </tr>
  <tr>
    <td bgcolor="#F7F7F7"><div align="right">How did you hear about us?</div></td>
    <td bgcolor="#F7F7F7">        
        <div align="left">
            <select id="hear_about_us" runat="server">
                                <option value="None Selected">Select</option>
                      <option>Colour Pages</option>
                      <option>Direct Mail</option>  
                      <option>Internet</option>  
                      <option>Referral</option>  
                      <option>Yellow Pages</option>  
                      <option>Yell.com</option>
                      <option>Other</option>  
            </select>
          </div></td>
    <td>
      <div align="left"></div></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#F7F7F7">Please call me to set-up the EPA (Email Protection Agency) FREE 15 day trial.
            <asp:CheckBox ID="callback" runat="server" Checked="true" />
        </td>
    <td></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#F7F7F7">
    <td></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#F7F7F7">Tick here to keep you up to date with the latest IT devleopments. Get more out of your existing technologies, find out about essential resources, new technology guides & time saving hints to help you get more done, cost effectively. Please untick the box if you do not want to subscribe.
<asp:CheckBox ID="keep_todate" runat="server" Checked="true" /></td>
    <td></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td colspan="3"><div align="center">
            <input type="submit" OnServerClick="Submit_Click" value="Submit" runat="server">
            <span class="style6">only submit once
            </span> </div></td>
    </tr>
</table>

</form>

            <!-- InstanceEndEditable --></div>
</div>
      <div class="box4">
              For more information call:<br>
            <b>Gary Howells on 020 7591 5455 or Robert Saleh on 020 7591 5454<br></b>
             or <a href="mailto:email sales@connectinglondon.com ">email sales@connectinglondon.com </a></div>
      </td>
            <td style="width: 5%; background: #EEE; border-left: 1px solid #AAA;">&nbsp;</td>
      </tr>
</table>
</body>
<!-- InstanceEnd --></html>
 
Related Solutions
Keywords: send email out then submit is clicked an…
 
Loading Advertisement...
 
[+][-]09/07/04 05:38 AM, ID: 11996104Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Programming for ASP.NET
Tags: postcode, requiredfieldvalidator, dim
Sign Up Now!
Solution Provided By: AerosSaga
Participating Experts: 2
Solution Grade: A
 
[+][-]09/07/04 04:21 AM, ID: 11995554Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/07/04 04:32 AM, ID: 11995627Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09/07/04 05:43 AM, ID: 11996140Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92