PHP code for mailing Contact Us page's filled form details not working

Dear friends,
I am newbie to this site and to php too. I dabble here and there trying to assemble pieces of codes from here and there for developing my site. I have been using a template for my website. However when I am trying to use php file (processmyform.php) to get the data filled in the form on the contact page (contact.html) by mailing it to me, i always get the predefined error message on submitting the form irrespective of the fact whether all the fields are filled or not. I am attaching the javascript file (javascriptcontent.js) too for you to have a complete. If anyone can help me with this problem I will be really grateful. Here is the code:

1. contact.html

[code]

.Black { color: #000; }
                      </tr>
                    </table>
                </td>
              </tr>
               <tr>
                <td  style="width:676px; height:563px">
                    <table  cellspacing="0" cellpadding="0">
                      <tr>
                        <td  style="width:226px; height:563px">
                            <a href="index.html"><img src="images/back.gif" alt="" border="0"></a><img src="images/pic5_1.gif" alt=""><br>
                            <img src="images/pic5_2.gif" alt=""><br>
                            <a href="index-1.html"><img src="images/home.jpg" alt="" border="0"></a><a href="index-2.html"><img src="images/We.jpg" alt="" border="0"></a><br>
                        <a href="index-3.html"><img src="images/service.jpg" alt="" border="0"></a><a href="index-5.html"><img src="images/contact.jpg" alt="" border="0"></a><br> </td>
                        <td  style="width:450px; height:563px; background-color:#F8F8F8; background-image:url(images/top.gif); background-repeat:no-repeat">
                            <table  cellspacing="0" cellpadding="0">
                              <tr>
                                <td  style="width:450px; height:563px; background-image:url(images/bottom.gif); background-repeat:no-repeat; background-position: left bottom" class="list">
                                    <p><br style="line-height:30px">
                                    <img src="images/title5_1.gif" alt="" style="margin-left:29px"><br>
                                    <br style="line-height:9px">
                                    <img src="images/pic5_3.gif" alt="" align="left" style="margin-left:30px; margin-top:2px; margin-right:14px"><br><strong>xyz</strong><br>

A z



Freephone:  +00 000 000 0000

Telephone:  +00 000 000 0000















Praesent vestibu lum molestie lacus. Aenean nonummy hendrerit mauris.





















<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=’’/>





                                                </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">&quot;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">&nbsp;</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 &copy; 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>
<textarea name=“message” cols=“0” rows=“0” onFocus=this.value=’’>Message:
[/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]







Contact Us - Complete!

We have received your information. We will revert back to you with a response as soon as possible.


                                </td>
                              </tr>
                            </table>
                        </td>
                      </tr>
                    </table>
                </td>    
              </tr>
               <tr>
                <td  style="width:676px; height:98px" class="policy"><div align="justify">
                  <p align="center">&nbsp;</p>
                  <p align="center"><span class="policy" style="width:676px; height:25px">Patent Search | Patent Filing | Patent Drafting | Patent Outsourcing | <span class="policy" style="width:676px; height:25px">Offshoring </span>Patent Services |  Patent Attorney | Trademark Search | Trademark Filing |   Trademark Services Outsourcing | Trademark Attorney | India US Europe <br>
                    IPJuvares.Com &copy; 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]
Sponsor our Newsletter | Privacy Policy | Terms of Service