Current location: Hot Scripts Forums » Programming Languages » ASP » ASP: Sending a HTML form to an email address

ASP: Sending a HTML form to an email address

Reply
  #1 (permalink)  
Old 02-09-07, 12:07 AM
cancer10 cancer10 is offline
Wannabe Coder
 
Join Date: Oct 2006
Location: India
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Question ASP: Sending a HTML form to an email address

Hi,

I am using CDONTs for sending email using ASP. I need to send a HTML form that takes values from a MS SQL Server database. How do I send this big code of form using ASP?

I am using the following code to send the email


Code:
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mymail@mydomain.com"
myMail.To="someone@somedomain.com"
myMail.HTMLBody = "--FORM CODE HERE--" 
myMail.Send
set myMail=nothing
%>


The code for the form is as below

Code:
<form method="post" target="_blank" action="http://tulleeho.com/tastemaker/members-feedback.asp">
  <table width="70%" border="0" align="center" cellpadding="3" cellspacing="4" style="border:1px dotted #CCCCCC;">
    <tr>
      <td class="style1"><div align="right"><span class="style1">Name:</span></div></td>
      <td><input type="text" name="txtuserFirstName" value="<% =rs("userFirstName") %>"></td>
    </tr>
    <tr class="style1">
      <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
    </tr>
    <tr>
      <td class="style1"><div align="right">Age:</div></td>
      <td><input type="text" name="txtUserAge" value="<%= datediff("yyyy",year(date),rs("userdateofBirth")) %>"></td>
    </tr>
    <tr class="style1">
      <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
    </tr>
    <tr>
      <td class="style1"><div align="right">Sex:</div></td>
      <td><select name="txtuserSex">
        <option value="<% if rs("usersex") = "True" then 	response.Write "1"
	if rs("usersex") = "False" then	response.Write "0"%>"><% if rs("usersex") = "True" then 	response.Write "Male"
	if rs("usersex") = "False" then	response.Write "Female"%></option>
        <option value="<% if rs("usersex") = "True" then response.Write "0"
		if rs("usersex") = "False" then	response.Write "1"%>"><% if rs("usersex") = "True" then 	response.Write "Female"
	if rs("usersex") = "False" then	response.Write "Male"%></option>
      </select>    </td>
    </tr>
    <tr class="style1">
      <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
    </tr>
    <tr>
      <td class="style1"><div align="right">City:</div></td>
      <td><select name="txtUserCity">
        <option <% if rs("userCity") = "Bangalore" then response.Write "selected" %>>Bangalore</option>
        <option <% if rs("userCity") = "New Delhi" then response.Write "selected" %>>New Delhi</option>
        <option <% if rs("userCity") = "Mumbai" then response.Write "selected" %>>Mumbai</option>
        <option <% if rs("userCity") = "Hyderabad" then response.Write "selected" %>>Hyderabad</option>
        <option <% if rs("userCity") = "Pune" then response.Write "selected" %>>Pune</option>
        <option <% if rs("userCity") = "Jaipur" then response.Write "selected" %>>Jaipur</option>
      </select>    </td>
    </tr>
    <tr class="style1">
      <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
    </tr>
    <tr>
      <td class="style1"><div align="right">Mobile No.: </div></td>
      <td><input type="text" name="txtuserPhoneNumberM" value="<% =rs("userPhoneNumberM") %>"></td>
    </tr>
    <tr class="style1">
      <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
    </tr>
    <tr>
      <td class="style1"><div align="right">Occupation:</div></td>
      <td><input type="text" name="txtuserOccupation"></td>
    </tr>
    <tr class="style1">
      <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
    </tr>
    <tr>
      <td valign="top" class="style1"><div align="right">Favourite Beverages:</div></td>
      <td valign="top" class="style1">
        Vodka: 
        <input type="checkbox" name="chkfav_bev" value="Vodka">
        Baileys:  <input type="checkbox" name="chkfav_bev" value="Baileys">
        
        Liqueur:  
        <input type="checkbox" name="chkfav_bev" value="Liqueur">
        <br>
        Tequila:  <input type="checkbox" name="chkfav_bev" value="Tequila">
        
        Whisky:  
        <input type="checkbox" name="chkfav_bev" value="Whisky">
        Peach Schnapps:  <input type="checkbox" name="chkfav_bev" value="Peach Schnapps">
        <br>
        Beer:  
        <input type="checkbox" name="chkfav_bev" value="Beer">
        Dark Rum:  <input type="checkbox" name="chkfav_bev" value="Dark Rum">
        
        White Rum:   
        <input type="checkbox" name="chkfav_bev" value="White Rum">
        Wine:  <input type="checkbox" name="chkfav_bev" value="Wine">
        Gin:  <input type="checkbox" name="chkfav_bev" value="Gin">      </td>
    </tr>
    <tr class="style1">
      <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
    </tr>
    <tr>
      <td valign="top" class="style1"><div align="right">****tails you drink:</div></td>
      <td><input type="text" name="txtuser****tails">
        <br>
        <input type="text" name="txtuser****tails">
        <br>
        <input type="text" name="txtuser****tails">
        <br>
      <input type="text" name="txtuser****tails"></td>
    </tr>
    <tr class="style1">
      <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
    </tr>
    <tr>
      <td valign="top" class="style1"><div align="right">Brands you purchase:</div></td>
      <td><p>
        <input type="text" name="txtuserBrands">
          <br>
        <input type="text" name="txtuserBrands">
        <br>
        <input type="text" name="txtuserBrands">
        <br>
        <input type="text" name="txtuserBrands">
        </p>
      <p>&nbsp; </p></td>
    </tr>
    <tr class="style1">
      <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
    </tr>
    <tr>
      <td class="style1"><div align="right">Favourite bar:</div></td>
      <td><input type="text" name="txtuserFavBar"></td>
    </tr>
    <tr class="style1">
      <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
    </tr>
    <tr>
      <td class="style1"><div align="right">Monthly spend on alcoholic beverages:</div></td>
      <td><select name="txtuserMonthlySpend">
        <option>0-500</option>
        <option>501-1000</option>
        <option>1001-1500</option>
        <option>More then 1500</option>
      </select>    </td>
    </tr>
    <tr class="style1">
      <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
    </tr>
    <tr>
      <td class="style1"><div align="right"></div></td>
      <td><input name="subfeedback" type="submit" id="subfeedback" value="Submit"></td>
    </tr>
  </table>
  <input name="txtuserid" type="hidden" value="<%=rs("userid") %>">
</form>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 02-09-07, 07:09 PM
koncept koncept is offline
Community VIP
 
Join Date: Oct 2004
Location: Cleveland Ohio
Posts: 1,791
Thanks: 0
Thanked 0 Times in 0 Posts
you would just enclose all that code into quotes and adjust the database sections accordingly.

do they need to fill in the form and send it back? if so you are better sending a link...
__________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
- Rich Cook

Please use code tags....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP help for validation of HTML form with javascript dhanashree ASP 2 03-22-06 02:28 PM
formmail problem gscraper Perl 12 08-27-04 04:06 AM
Sending form data + attatchments in email php-learner PHP 2 02-14-04 01:18 AM


All times are GMT -5. The time now is 07:56 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.