<input name=“name” type=“text” value=“Name:” onFocus=this.value=’’/> |
<input name=“company” type=“text” value=“Company:” onFocus=this.value=’’/> |
<input name=“telephone” type=“text” value=“Telephone:” onFocus=this.value=’’/> |
<input name=“email” type=“text” value=“E-mail:” onFocus=this.value=’’/> |
|
<textarea name=“message” cols=“0” rows=“0” onFocus=this.value=’’>Message: |
</table>
</td>
</tr>
</table>
</form>
<br style="line-height:1px">
<img src="images/spacer.gif" alt="" width="116" height="1"><strong><a href="#" onClick="document.getElementById('contactus').reset()">reset</a></strong><img src="images/spacer.gif" alt="" width="15" height="1"><strong><a href="#" onClick="document.getElementById('contactus').submit()">send</a></strong> </div>
<br style="line-height:14px">
<img src="images/px2_1.gif" alt="" style="margin-left:29px"><br style="line-height:24px">
<br>
<div style="margin-left:30px">
<div align="justify"><span class="Black">"There are four ways, and only four ways, in which we <strong>contact</strong> with the world. We are evaluated and classified by these four: what we do, how we look, what we say, and how we say it."</span><br>
<img src="images/spacer.gif" alt="" width="270" height="1"><span>- Dale Carnegie</span><br style="line-height:11px">
</div>
<table cellspacing="0" cellpadding="0">
<tr>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="width:676px; height:98px" class="policy"><div align="justify">
<p align="center"> </p>
<p align="center"><span class="policy" style="width:676px; height:25px">P | g | <span class="policy" style="width:676px; height:25px">Og </span>P | e <br>
xyz.Com © 2012 <img src="images/img.gif" alt=""> <a href="index-6.html">Privacy Policy</a></span></p>
</div></td>
</tr>
</table>
</td>
<td style="width:48px; height:780px"></td>
</tr>
</table>
</td>
[/code]
2. processmyform.php
[php]<?php
$errors=0;
$error=“The following errors occured while processing your form input.
”;
$name= array_key_exists(‘name’, $_POST) ? $_POST[‘name’] : null;
$company= array_key_exists(‘company’, $_POST) ? $_POST[‘company’] : null;
$telephone=array_key_exists(‘telephone’, $_POST) ? $_POST[‘telephone’] : null;
$email=array_key_exists(‘email’, $_POST) ? $_POST[‘email’] : null;
$message=array_key_exists(‘message’, $_POST) ? $_POST[‘message’] : null;
if($name=="" || $company=="" || $telephone=="" || $email=="" || $message=="" ){
$errors=1;
$error.=“You did not complete one or more fields, please go back and try again!”;
}
if($errors==1) echo $error;
else{
$where_form_is=“http”.($HTTP_SERVER_VARS[“HTTPS”]==“on”?“s”:"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: “.$name.”
Company: “.$company.”
Telephone: “.$telephone.”
E-mail: “.$email.”
Message: “.$message.”
“;
$message = stripslashes($message);
mail("[email protected]”,“Form Submitted at your website”,$message,“From: xyz.com”);
header(‘Location: http://www.xyz.com/thanks.html’);
}
?>[/php]
3. javascriptcontent.js
[code]function MM_swapImgRestore() {
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() {
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) {
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() {
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function IsEmptyField(TextObj){
return IsEmptyStr(TextObj.value)
}
function IsEmptyStr(Str){
var retval = true;
for (var i=0; i < Str.length; ++i){
var c = Str.charAt(i);
if (c != ' ' && c != '\t')
retval = false;
}
return retval;
}
function checkcontactus() {
if (IsEmptyField(document.contactus.name)){
alert (“Please Enter Your Full Name”);
return false;
}
if (IsEmptyField(document.contactus.company)){
alert (“Please Enter Your Company Name”);
return false;
}
if (IsEmptyField(document.contactus.telephone)){
alert (“Please Enter Your Telephone Number”);
return false;
}
if (IsEmptyField(document.contactus.email)){
alert (“Please Enter Your Email Address”);
return false;
}
if(document.contactus.email.value.indexOf("@")==-1 || document.contactus.email.value.indexOf(".")==-1){
alert (“Please Input a Correct Email Address”)
return false;
}
if (IsEmptyField(document.contactus.message)){
alert (“Please Enter Your Message To Send”);
return false;
}
return true;
}[/code]
4. thanks.html
[code]
|