简体   繁体   English

404错误联系表单引导程序

[英]404 error contact form bootstrap

After reading about every single forum post I still cannot figure out how to get my contact form to work correctly. 在阅读了每个论坛的帖子后,我仍然无法弄清楚如何使我的联系表正常工作。 I got the frontend part of it looking good but I am getting a 404 error every time I try to use it. 我的前端部分看起来不错,但是每次尝试使用它时都会遇到404错误。 Obviously, because of that none of the information submitted is getting through. 显然,由于这个原因,提交的所有信息都无法通过。 Here is my code: 这是我的代码:

Here is my contact.php which has a 这是我的contact.php,其中有一个

<script src="email/validation.js" type="text/javascript"></script>

at the top between the header 在标题之间的顶部

<div class="span12" id="divMain">
     <div id="contact"> 
      <h1>Contact Us</h1></div>
         <h3 style="color:#FF6633;"><?php echo $_GET[msg];?></h3>
   <hr>
<!--Start Contact form -->                                                      
 <form name="enq" method="post" action="email/index.php" onsubmit="return     
           validation();">
 <fieldset>    

<input type="text" name="name" id="name" value=""  class="input-block-level"    placeholder="Name" />

<input type="text" name="email" id="email" value="" class="input-block-level"  placeholder="Email" />
 <textarea rows="9" name="message" id="message" class="input-block- levelplaceholder="Let's hear what you've got to say"> </textarea>
<div class="actions">
    <input type="submit" value="Send" name="submit" id="submitButton" class="btn btn-success pull    -right" title="Click here to submit your message!" />
     </div> 
</fieldset>
    <hr>
     </form>                 
<!--End Contact form -->                                             
    </div>

Next here is my validation.js 接下来是我的validation.js

function validation()
 {
var contactname=document.enq.name.value;
var name_exp=/^[A-Za-z\s]+$/;
if(contactname=='')
{
    alert("Name Field Should Not Be Empty!");
    document.enq.name.focus();
    return false;
}
else if(!contactname.match(name_exp))
{
    alert("Invalid Name field!");
    document.enq.name.focus();
    return false;
}

var email=document.enq.email.value;
//var email_exp=/^[A-Za-z0-9\.-_\$]+@[A-Za-z]+\.[a-z]{2,4}$/;
var email_exp=/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if(email=='')
{
    alert("Please Enter Email-Id!");
    document.enq.email.focus();
    return false;
}
else if(!email.match(email_exp))
{
    alert("Invalid Email ID !");
    document.enq.email.focus();
    return false;
}


var message=document.enq.message.value;
if(message=='')
{
    alert("Query Field Should Not Be Empty!");
    document.enq.message.focus();
    return false;
}
return true; }

Followed by my index.php 其次是我的index.php

<?php
if(isset($_POST['submit']))
{
$name = $_POST['name'];
$email = $_POST['email'];
$query = $_POST['message'];
$email_from = $name.'<'.$email.'>';

$to="marketing@durangoconnections.com";
$subject="Enquiry!";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: ".$email_from."\r\n";
$message="    

     Name:
     $name     
     <br>
     Email-Id:
     $email        
     <br>
     Message:
     $query        
    ";
 if(mail($to,$subject,$message,$headers))
    header("Location:../contact.php?msg=Successful Submission! Thankyou for contacting     us.");
else
    header("Location:../contact.php?msg=Error To send Email !");
    //contact:-your-email@your-domain.com
}
?>

You dont have a contact.php file on your server, you mean contact_us.php 您的服务器上没有contact.php文件,您的意思是contact_us.php

if(mail($to,$subject,$message,$headers))
    header("Location:../contact_us.php?msg=Successful Submission! Thankyou for contacting     us.");
else
    header("Location:../contact_us.php?msg=Error To send Email !");
    //contact:-your-email@your-domain.com
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM