php - Contact Form Won't work:\ -


i downloaded template, can't form work. great! wifes website... please me hero:) here's mailhandler.php...

<?php $owner_email = $_post["owner_email"]; $headers = 'from:' . $_post["email"]; $subject = 'a message site visitor ' . $_post["name"]; $messagebody = "";  $messagebody .= '<p>visitor: ' . $_post["name"] . '</p>' . "\n"; $messagebody .= '<br>' . "\n"; $messagebody .= '<p>email address: ' . $_post['email'] . '</p>' . "\n"; $messagebody .= '<br>' . "\n"; if($_post['state']!='nope'){             $messagebody .= '<p>state: ' . $_post['state'] . '</p>' . "\n";     $messagebody .= '<br>' . "\n"; } if($_post['phone']!='nope'){             $messagebody .= '<p>phone number: ' . $_post['phone'] . '</p>' . "\n";     $messagebody .= '<br>' . "\n"; }    if($_post['fax']!='nope'){           $messagebody .= '<p>fax number: ' . $_post['fax'] . '</p>' . "\n";     $messagebody .= '<br>' . "\n"; } $messagebody .= '<p>message: ' . $_post['message'] . '</p>' . "\n";  if($_post["striphtml"] == 'true'){     $messagebody = strip_tags($messagebody); }  try{     if(!mail($owner_email, $subject, $messagebody)){         throw new exception('mail failed');     }else{         echo 'mail sent';     } }catch(exception $e){     echo $e->getmessage() ."\n"; } 

?>

here's form.js

(function($){ $.fn.extend({     forms:function(opt){         if(opt===undefined)             opt={}         this.each(function(){             var th=$(this),                 data=th.data('forms'),                 _={                     errorcl:'error',                     emptycl:'empty',                     invalidcl:'invalid',                     successcl:'success',                     successshow:'4000',                     mailhandlerurl:'mail/mailhandler.php',                     owneremail:'office@swissqualitysmile.com',                     striphtml:true,                     smtpmailserver:'localhost',                     targets:'input,textarea',                     controls:'a[data-type=reset],a[data-type=submit]',                     validate:true,                     rx:{                         ".name":{rx:/^[a-za-z'][a-za-z-' ]+[a-za-z']?$/,target:'input'},                         ".state":{rx:/^[a-za-z'][a-za-z-' ]+[a-za-z']?$/,target:'input'},                         ".email":{rx:/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i,target:'input'},                         ".phone":{rx:/^\+?(\d[\d\-\+\(\) ]{5,}\d$)/,target:'input'},                         ".fax":{rx:/^\+?(\d[\d\-\+\(\) ]{5,}\d$)/,target:'input'},                         ".message":{rx:/.{20}/,target:'textarea'}                     },                     prefu:function(){                         _.labels.each(function(){                             var label=$(this),                                 inp=$(_.targets,this),                                 defval=inp.val()                             label.data({defval:defval})                             inp                                 .bind('focus',function(){                                     if(inp.val()==defval)                                         inp.val('')                                 })                                 .bind('blur',function(){                                     if(!inp.val())                                         inp.val(defval)                                     else                                         (_.isvalid(label)                                             ?_.showerrorfu(label)                                             :_.hideerrorfu(label)),                                         (_.isempty(label)                                             ?_.showemptyfu(label)                                             :_.hideemptyfu(label))                                 })                             label.find('.'+_.errorcl+',.'+_.emptycl).css({display:'block'}).hide()                         })                         _.success=$('.'+_.successcl,_.form).hide()                     },                     isvalid:function(el){                         var ret=true                         if(_.isempty(el))                             ret=false,                             el.addclass(_.invalidcl)                         else                         $.each(_.rx,function(k,d){                             if(el.is(k))                                 d.rx.test(el.find(d.target).val())                                     ?(el.removeclass(_.invalidcl),ret=false)                                     :el.addclass(_.invalidcl)                         })                         return ret                     },                     isempty:function(el){                         var ret=false,                             field=el.find(_.targets).val()                         if(field==''||field==el.data('defval'))                             ret=true                         return ret                     },                     validatefu:function(){                                                   _.labels.each(function(){                             var th=$(this)                                                           _.isempty(th)                                 ?_.showemptyfu(th)                                 :_.hideemptyfu(th)                             _.isvalid(th)                                 ?_.showerrorfu(th)                                 :_.hideerrorfu(th)                         })                     },                     submitfu:function(){                         _.validatefu()                         if(!_.form.has('.'+_.invalidcl).length)                             $.ajax({                                 type: "post",                                 url:_.mailhandlerurl,                                 data:{                                     name:$('.name input',_.form).val(),                                                                          email:$('.email input',_.form).val(),                                     phone:$('.phone input',_.form).val()||'nope',                                     fax:$('.fax input',_.form).val()||'nope',                                     state:$('.state input',_.form).val()||'nope',                                     message:$('.message textarea',_.form).val(),                                     owner_email:_.owneremail,                                     striphtml:_.striphtml                                 },                                 success: function(){                                     _.showfu()                                 }                             })                               },                     showfu:function(){                         _.success.slidedown(function(){                             settimeout(function(){                                 _.success.slideup()                                 _.form.trigger('reset')                             },_.successshow)                         })                     },                     controlsfu:function(){                         $(_.controls,_.form).each(function(){                             var th=$(this)                             th                                 .bind('click',function(){                                     _.form.trigger(th.data('type'))                                     return false                                 })                         })                     },                     showerrorfu:function(label){                         label.find('.'+_.errorcl).slidedown()                     },                     hideerrorfu:function(label){                         label.find('.'+_.errorcl).slideup()                     },                     showemptyfu:function(label){                         label.find('.'+_.emptycl).slidedown()                         _.hideerrorfu(label)                     },                     hideemptyfu:function(label){                         label.find('.'+_.emptycl).slideup()                     },                     init:function(){                         _.form=this                         _.labels=$('label',_.form)                          _.prefu()                          _.controlsfu()                          _.form                             .bind('submit',function(){                                 if(_.validate)                                     _.submitfu()                                 else                                     _.form[0].submit()                                 return false                             })                             .bind('reset',function(){                                 _.labels.removeclass(_.invalidcl)                                                                    _.labels.each(function(){                                     var th=$(this)                                     _.hideerrorfu(th)                                     _.hideemptyfu(th)                                 })                             })                     }                 }             if(!data)                 (typeof opt=='object'?$.extend(_,opt):_).init.call(th),                 th.data({cscroll:_}),                 data=_             else                 _=typeof opt=='object'?$.extend(data,opt):data         })         return     } }) 

})(jquery)

here's html...

 <div class="grid_8 suffix_1 omega">                                 <p>&nbsp;</p>                                 <h3 class="margin-bot">appointment request , contact form</h3>                                 <form action="mail/mailhandler.php" id="contact-form">                                     <div class="success"> contact form submitted!<br>                                     <strong>we in touch soon.</strong> </div>                                     <fieldset>                                         <label class="name">                                         <input type="text" value="name:">                                         <span class="error">*this not valid name.</span> <span class="empty">*this field required.</span> </label>                                         <label class="email">                                         <input type="email" value="e-mail:">                                         <span class="error">*this not valid email address.</span> <span class="empty">*this field required.</span> </label>                                         <label class="phone">                                         <input type="tel" value="phone:">                                         <span class="error">*this not valid phone number.</span> <span class="empty">*this field required.</span> </label>                                         <label class="message">                                         <textarea>enter message or desired date , time appointment:</textarea>                                         <span class="error">*the message short.</span> <span class="empty">*this field required.</span> </label>                                         <div class="buttons-wrapper">                                             <a class="button" data-type="reset">clear</a>                                             <a class="button" data-type="submit">send</a>                                                                   </div>                                                                               </fieldset>                                 </form>                             </div>                         </div>                     </div>                 </div>             </div> 


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -