PDA

View Full Version : can anyone check code



newj
02-18-2007, 04:13 PM
yahoooooooooo!

finally I am nearing my destination though it still seems still far off. Guys i have been asking for help from this forum.. it has trickled though but not enough for me as a layman in asp or any programming....


well I have finally managed to be near completion of my email form on my website but there are some errors.. can anyone help me in this...

1.... I dont want the user info to be displayed on the website itself (its happening ....). rather this info should come to my mail box. sales@mobiconcommodities.com. What am I doing wrong????. plz see my site... www.mobiconcommodities.com. click on enquiry link...

below is the code I am using..

Enquiry.htm

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<style type="text/css">
<!--
a:link {
color: #93A81C;
}
-->
</style>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="549" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"><img src="images/trans_bar.gif" width="1" height="30"></td>
</tr>
<tr>
<td width="5" align="left" valign="top" bgcolor="#FFFFFF"><img src="images/trans_bar.gif" width="5" height="1"></td>
</tr>
<tr>
<td align="left" valign="top"><table width="545" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" rowspan="4"></td>
<td height="16" align="right" valign="top"><img src="images/enquiry_txt.gif" width="80" height="16" align="top"></td>
<td width="10" rowspan="4"><img src="images/trans_bar.gif" width="10" height="1"></td>
</tr>
<tr>
<td width="1" valign="top" bgcolor="#5C97D1"><img src="images/trans_bar.gif" width="1" height="1"></td>
</tr>
<tr>
<td height="7" align="left" valign="top"><img src="images/blue_dot.gif" width="5" height="7"></td>
</tr>
<tr>
<td valign="top"><div align="justify">
<p class="m_text"><br>
As a specialist trading company we offer Sugar, Urea and Containerise HMS 1 &amp; 2. These commodities are sourced directly from manufacturers and mandates and can be supplied at any quantity and to any location.</p>
<p class="m_text">Please email us with your requirements mentioning the following details:</p>
<table width="100%" border="0" cellspacing="2" cellpadding="5">
<tr>
<td valign="top"><SCRIPT>
String.prototype.trim = function()
{
// skip leading and trailing whitespace
// and return everything in between
return this.replace(/(^\s *)|(\s*$)/g,"")
}

function validateEmail(obj)
{
//Validates email
var tempEmail = obj.value.trim();
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(tempEmail))
{
return true;
}
else
{
alert("Incorrect email address");
obj.focus();
return false;
}
}


function validateForm()
{
//Email validation
if(document.mobicon.txtEmail.value.trim() == '')
{
alert("Email Id is required");
document.mobicon.txtEmail.focus();
return false;
}
if(!validateEmail(document.mobicon.txtEmail))
{
return false;
}

//Name validation
if(document.mobicon.txtName.value.trim() == '')
{
alert("Name is required");
document.mobicon.txtName.focus();
return false;
}
return true;
}
</SCRIPT>
<FORM name="mobicon" onsubmit="return validateForm();" action="form_ac.asp" target="centerframe" method="post">
<p> <span class="m2_text">YourName*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
<input name="txtName" type="text" id="txtName2" size="30" maxlength="100">
</p>
<p> <span class="m2_text">Organisation:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="txtOrg" type="text" id="txtOrg2" size="30" maxlength="100">
</p>
<p><span class="m2_text">Address:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="textAdd" type="text" id="textAdd" value="" size="30">
</p>
<p><span class="m2_text">email ID*:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="txtEmail" type="text" id="txtEmail" size="30" maxlength="100">
</p>
<p><span class="m2_text">Commodities:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<textarea name="textcommodities" cols="22" rows="4" id="textcommodities"></textarea>
</p>
<p><span class="m2_text">Quantity:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<input name="textquantity" type="text" id="textquantity" size="30" maxlength="150">
</p>
<p><span class="m2_text">Destination:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="textdestination" type="text" id="textdestination" size="30" maxlength="100">
</p>
<p><span class="m2_text">Timeframe:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="texttimeframe" type="text" id="texttimeframe" size="30" maxlength="100">
</p>
<p><span class="m2_text">Payment Methood:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="textpayment" type="text" id="textpayment" size="30" maxlength="100">
<br>
(DLC / SBLC / BG / <br>
TT/ DAP)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span> </p>
<p><span class="m2_text">Comments:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<textarea name="txtcomments" cols="23" rows="4" id="txtcomments"></textarea>
</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT name="email" type=submit id="email" value="E-mail">
</p>
</form></td>
</tr>
</table>
<p></p>
</div></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>



form_ac.asp


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
%>
<%
txtName=Request.Form("txtName")
txtOrg=Request.Form("txtOrg")
textAdd=Request.Form("textAdd")
txtEmail=Request.Form("txtEmail")
textcommodities=Request.Form("textcommodities")
textquantity=Request.Form("textquantity")
textdestination=Request.Form("textdestination")
texttimeframe=Request.Form("texttimeframe")
textpayment=Request.Form("textpayment")
txtcomments=Request.Form("txtcomments")

body=body & "<table align=center><tr><td><b><u>ENQUIRY FORM</u></b></td><tr></table>"
body=body & "<table align=center><tr><td>&nbsp;</td><tr></table>"
body=body & "<table align=center WIDTH=650><tr><td WIDTH=200 bgcolor=CCCCCC>The organisation is : </td><td>" & txtName & "</td></tr>"
body=body & "<tr><td WIDTH=200 bgcolor=CCCCCC>The organisation is : </td><td>" & txtOrg & "</td></tr>"
body=body & "<tr><td WIDTH=200 bgcolor=CCCCCC>The address is : </td><td>" & textAdd & "</td></tr>"
body=body & "<tr><td WIDTH=200 bgcolor=CCCCCC>The email is : </td><td>" & txtEmail & "</td></tr>"
body=body & "<tr><td WIDTH=200 bgcolor=CCCCCC>The commodities are : </td><td>" & textcommodities & "</td></tr>"
body=body & "<tr><td WIDTH=200 bgcolor=CCCCCC>The quantities are : </td><td>" & textquantity & "</td></tr>"
body=body & "<tr><td WIDTH=200 bgcolor=CCCCCC>The destination is : </td><td>" & textdestination & "</td></tr>"
body=body & "<tr><td WIDTH=200 bgcolor=CCCCCC>The time required is : </td><td>" & texttimeframe & "</td></tr>"
body=body & "<tr><td WIDTH=200 bgcolor=CCCCCC>The payment mode is : </td><td>" & textpayment & "</td></tr>"
body=body & "<tr><td WIDTH=200 bgcolor=CCCCCC>The comments are : </td><td>" & txtcomments & "</td></tr></table>"

response.Write body
response.end

Set ObjCDOMail = Server.CreateObject("CDONTS.Newmail")
ObjCDOMail.From =email
ObjCDOMail.To ="sales@mobiconcommodities.com"
'ObjCDOMail.Cc ="....@emirates.net.ae"
ObjCDOMail.BodyFormat = 0
ObjCDOmail.Mailformat = 0
ObjCDOMail.Subject = "Enquiry from the website"
ObjCDOMail.body=body
ObjCDOMail.Send
Set ObjCDOMail = Nothing
%>
<html>
<head>
<title>Thank you for the enquiry.</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="300"><div align="center" class="sugarblubold_text"><span class="bluebold_text">Thank you for the enquiry. We will contact you soon</span>.</div></td>
</tr>
</table>
</body>
</html>


I am also using CSS but only for the text colors or fonts