Click to See Complete Forum and Search --> : Whats the problem??


dennic
08-25-2003, 02:07 AM
I am only just starting to learn the basics for asp, I have tried to do some code (with some help from a site) for a basic form to email script.

I dont know if i have done it correctly, because it doesnt seem to be working right. I have written the code and saved it as a separate file to the email form.

here is the asp code

'Fields to collect the information

<%
strName = Request.QueryString("Name")
strCompanyName = Request.QueryString("CompanyName")
strEmail = Request.QueryString("Email")
strMobileNumber = Request.QueryString("MobileNumber")
strFaxNumber = Request.QueryString("FaxNumber")
strComments = Request.QueryString("Comments")
%>

'Tells the customer what they have sent

Name: <%= strName %>
Company Name: <%= strCompanyName %>
Email: <%= strEmail %>
Mobile Number: <%= strMobileNumber %>
Fax Number: <%= strFaxNumber %>
Comments: <%= strComments %>

'Sends to info@dennic.com.au

<%
Set objCDOMessage = Server.CreateObject("CDONTS.NewMail")
'Creates the object
objCDO.Message.From = "customer@yahoo.com"
objCDO.Message.To = "info@dennic.com.au"
objCDO.Message.Subject = "Customer Enquiry Form"
objCDO.Message.Body = "The following information is submitted from customer" & vbcrlf &_

"Name:" & strName & vbcrlf &_
"Company Name:" & strCompanyName & vbcrlf &_
"Email:" & strEmail & vbcrlf &_
"Mobile Number:" & strMobileNumber & vbcrlf &_
"Fax Number:" & strFaxNumber & vbcrlf &_
"Comments:" & strComments

'Send the message
objCDOMessage.Send
'Finsh things off
Set objCDOMessgae = Nothing
%>



Here is the code from the form


<HTML>
<HEAD>
<title>Contact Page </title>
<LINK href="stylesheet3.css" type="text/css" rel="stylesheet">
<META NAME="keywords" content="web design, sydney, australia, NSW, country, parkes, orange, dubbo, forbes, web development, central coast, programming, java, html, dhtml, web hosting, web central, curl internet, demo, cambridge hotel, capricorn stone">
<META NAME="description" content="DENNIC - Web Design company located in Sydney.">
<style> #formcaption {position: absolute; left:70px; top:323px}
#footer {position: absolute; left:130px; top:640px}
#textarea {position: absolute; left:30px; top:450px}
</style>
</HEAD>
<!--Script-->
<SCRIPT LANGUAGE="javascript">

<!--

function submitted() {
c=document.contact;
if(c.name.value==""){
alert("You must enter your name!");
c.name.focus();
return false;
} else if(c.email.value==""){
alert("You must enter your email address!");
c.email.focus();
return false;
}
}
//-->
</SCRIPT>
<body>
<H2>
<center>
Contact Us
</H2>
<form method="get" action="Email.asp" name="Contact">
</CENTER>
<P>
<center>
<br>
<!--Table1-->
<TABLE cellSpacing="1" cellPadding="1" width="326" border="0">
<TR>
<TD width="45%"><b>Location:</b></TD>
<TD>Hornsby - Sydney</TD>
</TR>
<TR>
<TD><b>Phone Number:</b></TD>
<TD>+61 (02)94765834</TD>
</TR>
<TR>
<TD><b>Mobile:</b></TD>
<TD>0417665161</TD>
</TR>
<TR>
<TD><b>Email Address:</b></TD>
<TD>info@dennic.com.au</TD>
</TR>
</TABLE>
</center>
</P>
<!--Table-->
<table border="0" ID="Table1">
<tr>
<td><center>Alternatively simply fill out the form below and we will endeavour to
answer your message within 24 hours.</center>
</td>
</tr>
</table>
<br>
<br>
<center>
<!--Table2-->
<TABLE cellSpacing="1" cellPadding="1">
<TR>
<TD><b>Contact Name:</b></TD>
<TD><INPUT id="Text1" type="text" name="Name"> *</TD>
</TR>
<TR>
<TD><b>Company Name:</b></TD>
<TD><INPUT id="Text2" type="text" name="CompanyName"></TD>
</TR>
<TR>
<TD><b>Email Address:</b></TD>
<TD><INPUT id="Text3" type="text" name="Email"> *</TD>
</TR>
<TR>
<TD><b>Mobile Number:</b></TD>
<TD><INPUT id="Text4" type="text" name="MobileNumber"></TD>
</TR>
<TR>
<TD><b>Fax Number:</b></TD>
<TD><INPUT id="Text5" type="text" name="FaxNumber"></TD>
</TR>
</TABLE>
</center>
<br>
<br>
<center>
<TEXTAREA id="comments" name="Comments" rows="6" cols="33"> </TEXTAREA>
</center>
<!--Table3-->
<TABLE height="15" cellSpacing="0" cellPadding="0" width="70" border="0" ms_1d_layout="TRUE" id="textarea">
<TR>
<TD><b>Comments:</b></font>
</TD>
</TR>
</TABLE>
<br>
<br>
<center>
<INPUT type="submit" value="Send mail" name="contact" onClick="return submitted()">
</center>
<!--End of form--></form>
</body>
</HTML>


sorry about all the code. alternatively go to www.dennic.com.au and go to the contacts page
any help would be appreciative, thanks.