Jump to content


ASP Contact Form


1 reply to this topic

#1 Tirus

    P2L Jedi

  • Members
  • PipPipPip
  • 764 posts
  • Gender:Male
  • Location:Montreal, Canada
  • Interests:Web Design, Programming, Music, Martial Arts

Posted 19 August 2006 - 03:51 PM

CURRENTLY MODIFYING CODING TO REMOVE FORUM STRETCHING
ok, forum is back to normal....phew!

Hello everyone.

A client of mine had a previous web designer create a website for him....my job has been to fix all the errors as well as complete everything that the other designer left unfinished. Included in the site was a contact form in asp, that does not seem to work.
I know the very basics of asp (which have been enough so far to do my job) but I cannot seem to find what is wrong in the coding.

Here is the asp chunk of the coding for the contact form:
<%
if request.form("Submit")<>"" then
  
  pEmailAdmin="info@nationalbusinesslistings.com"
  
	strbname		= 	Request.Form("bname")
	strfname		=	Request.Form("fname")
	strlname		=	Request.Form("lname")
	strInNo			=	Request.Form("inNo")
	strrefNo		=	Request.Form("reNo")
	strCate			=	Request.Form("cate")
	strAddress		=	Request.Form("address")
	strCity			=	Request.Form("city")
	strState		=	Request.Form("state")
	strZip			=	Request.Form("zipcode")
	strPhone		=	Request.Form("phone")
	strPhone2		=	Request.Form("phone2")
	strFax			=	Request.Form("fax")
	strWeb			=	Request.Form("website")
	stremail		= 	Request.Form("email")
	strContactby	=	Request.Form("contactby")
	strcomments   	= 	Request.Form("comments")
   
pBody1="<table border=0 cellspacing=5 cellpadding=0 align=center width=600 ><tr><td colspan=2>"
pBody1=pBody1&"The following information has been submitted through the Contact Us form</td></tr>"
pBody1=pBody1&"<tr><td width=250>Business Name</td><td>:</td><td width=200>"&strbname&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>First Name</td><td>:</td><td width=200>"&strfname&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>Last Name</td><td>:</td><td width=200>"&strlname&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>Invoice No</td><td>:</td><td width=200>"&strInNo&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>Reference No</td><td>:</td><td width=200>"&strrefNo&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>Category</td><td>:</td><td width=200>"&strCate&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>Address</td><td>:</td><td width=200>"&strAddress&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>City</td><td>:</td><td width=200>"&strCity&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>State</td><td>:</td><td width=200>"&strState&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>Zip-Code</td><td>:</td><td width=200>"&strZip&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>Phone</td><td>:</td><td width=200>"&strPhone&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>Phone2</td><td>:</td><td width=200>"&strPhone2&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>Fax</td><td>:</td><td width=200>"&strFax"</td></tr>"
pBody1=pBody1&"<tr><td width=250>Website</td><td>:</td><td width=200>"&strWeb&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>Email Address</td><td>:</td><td width=200>"&stremail&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>Contact By</td><td>:</td><td width=200>"&strContactby&"</td></tr>"
pBody1=pBody1&"<tr><td width=250>Comment</td><td>:</td><td width=200>"&strcomments&"</td></tr></table>"



//Response.Write(pBody1)
//Response.End()

 //	pEmailAdmin	= stremail 
	Set objEMail = Server.CreateObject("CDO.Message")
	Set objConfig = Server.CreateObject("CDO.Configuration")
	Set Confi = objConfig.Fields
	Confi("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
	Confi("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "C:\inetpub\mailroot\pickup"
	Confi.Update
	Set objEMail.Configuration = objConfig
	objEMail.To = pEmailAdmin
	objEMail.From = stremail
	objEMail.Subject = "Contact Us"
	objEMail.HtmlBody = pBody1
	on error resume next
	objEMail.Send
	Set objEMail = Nothing
	
	//Starting the mail component section 
				  
	   msg="Thank you for contacting us, a representative will contact you soon" 
		end if
%>

<body >




			<table width="780" cellpadding="0" cellspacing="0" align="center" style="border-left:#ddd 1px solid; border-right:#ddd 1px solid;">
				<tr>
					<td style="background-image:url(images/bar1.jpg) " height="20">
					
					</td>
				</tr>
					<tr><td bgcolor="#FEF7EE" valign="top" height="40">&nbsp;&nbsp;<a href="default.asp" class="navlink4">Home</a> &raquo; <b> Contact Us</b></td></tr>
				<tr>
					<td height="200" bgcolor="#FEF7EE" align="center" valign="middle">
					<!-- <font size="+1">PAGE UNDER CONSTRUCTION</font> -->
					<FORM name="contactfm" METHOD="POST"  ACTION="contactus.asp"  onsubmit="return chkcontact();">
		<table cellspacing="10" cellpadding="0" border="0">
		<tr><td colspan="3"><%=msg%></td></tr>
		<tr>
		  <td colspan="3" height="20">
		<i><b> Please fill out this form and a representative will contact you as soon as possible 
</b>

			</td>
		</tr>
		<tr><td colspan="2" align="right"></td></tr>
		
		<tr><td colspan="2" align="right">
</td></tr>

<tr><td align="left" width="200">First Name</td><td width="300" align="left"><input type="text" name="fname"  size="35"/></td></tr>
<tr><td align="left" width="200">* Last Name</td><td width="300" align="left"><input type="text" name="lname"  size="35"/></td></tr>
<tr><td align="left" width="200">* Business Name</td><td width="300" align="left"><input type="text" name="bname"  size="35"/></td></tr>	
<tr><td align="left" width="200">Invoice No.</td><td width="300" align="left"><input type="text" name="inNo"  size="35"/></td></tr>
<tr><td align="left" width="200">Reference No.</td><td width="300" align="left"><input type="text" name="reNo"  size="35"/></td></tr>
<tr><td align="left" width="200">Address</td><td width="300" align="left"><input type="text" name="address"  size="35"/></td></tr>
<tr><td align="left" width="200">City</td><td width="300" align="left"><input type="text" name="city"  size="35"/></td></tr>
<tr><td align="left" width="200">* State</td><td width="300" align="left">
								<select name="state">
								<option value=""></option>
								<%if not rsState.eof then %>
								<%while not rsState.eof %>
								<option value="<%=rsState("stateName")%>"><%=rsState("stateName")%></option>
								<%rsState.movenext
								Wend
								end if%>
								</select> 
		</td></tr>
		<tr><td align="left" width="200">Zip-Code</td><td width="300" align="left"><input type="text" name="zipcode"  size="25" /></td></tr>
		<tr><td align="left" width="200">* Phone</td><td width="300" align="left"><input type="text" name="phone"  size="35" onKeyDown="java script:return dFilter (event.keyCode, this, '(###) ###-####');"/></td></tr>
		<tr><td align="left" width="200">Fax</td><td width="300" align="left"><input type="text" name="fax"  size="35" onKeyDown="java script:return dFilter (event.keyCode, this, '(###) ###-####');"/></td></tr>
		<tr>
		  <td align="right" width="225">Website<strong>http://</strong></td>
		<td width="225" align="right"><input type="text" name="website"  size="35"/></td></tr>		<tr><td align="left">Email</td><td align="left"><input type="text" name="email" size="35"/></td></tr>
		<tr><td align="left" width="200">Contact Method</td><td align="left">
		<select name="contactby">
		<option value="">Select</option>
		<option value="Phone">Phone</option>
		<option value="Email">Email</option>
				<option value="">Other</option>
		</select>
		

		</td></tr>
		<tr><td align="left" width="200" valign="top">* Comment</td><td align="left"><textarea name="comments" rows="6" cols="30"></textarea></td></tr>
		<tr><td colspan="3" align="left">&nbsp;&nbsp;<b><font color="#990000">*are required fields</font> </b></td></tr>


<tr><td colspan="1" height="20"></td></tr>
		<tr align="center"><td colspan="3"><input type="submit" name="submit" value="Submit" class="button"></td>
		</tr>
				
		
		</table>

		</form>
			Do you have any questions or need help? <br>
					 Send all questions or comments to?  <b><a href="mailto:info@nationalbusinesslistings.com" >info@nationalbusinesslistings.com</b></a>			
					</td>
				</tr>
				
				
<!-- 		<tr align="left"><td colspan="2" bgcolor="#FEF7EE" >&nbsp;&nbsp;<b>*are required fields</b> </td>
		</tr> -->
		
				<tr>
					<td style="background-image:url(images/bar2.jpg) " height="20">
					
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr><td bgcolor="#FEF7EE" height="15">
Any and all help with fixing this form would be greatly appreciated.

Tirus

Edited by Tirus, 19 August 2006 - 04:05 PM.


#2 Tirus

    P2L Jedi

  • Members
  • PipPipPip
  • 764 posts
  • Gender:Male
  • Location:Montreal, Canada
  • Interests:Web Design, Programming, Music, Martial Arts

Posted 20 August 2006 - 05:57 PM

ok, I manged to figure out why it was not working...the coding was perfect, it just that if an email address was not entered in the form, the form would not send...why, I do not know, but thats the way it works.

However, I do have a second question to ask. When I set the email address that the contact form will be sent to, it works for my website email address but not for my hotmail email address. Is it possible that Hotmail is not allowing the email to go through, as I am able to receive the email with my website email address?

Thanks,

Tirus

Edited by Tirus, 20 August 2006 - 06:01 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users