简体   繁体   English

我正在尝试通过 php 从我的联系我们页面向 email 发送 email 但它给出了错误我的代码和错误如下

[英]i am trying to send an email from my contact us page to email by php but it gives error my code and error given below

this is my html code.这是我的 html 代码。

<!DOCTYPE html>
<html>
<head>
    <title>form</title>
</head>
<body>

                        <form action="send.php" method="post" class="contact-form contact_form_u" id="">
                            <div class="form-group">
                                <input class="form-control  contact_user_fname" id="user-fname" name="user-fname" type="text" placeholder="First name :" required>
                            </div>
                            <div class="form-group">
                                <input class="form-control  contact_user_lname" id="user-lname" name="user-lname" type="text" placeholder="Last name :" required>
                            </div>
                            <div class="form-group">
                                <input class="form-control  contact_user_email" id="user-email" name="user-email" type="email" placeholder="Email :" required>
                            </div>
                            <div class="form-group">
                                <input class="form-control  contact_user_phone" id="user-phone_" name="user-phone" type="text" placeholder="Phone :" required>
                            </div>
                            
                            <div class="form-group">
                                <textarea class="form-control contact_user_message" name="user-message" id="user-message" placeholder="Message:" required></textarea>
                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-info btn-lg btn--highlight contact_btn_u" id="submit-btn" name="submit-btn">Send </button>
                            </div>
                            <div class="form-group">
                                <a class="btn btn-info btn-lg btn--highlight contact_btn_u_c" id="close_contact"  type="submit">Close</a>
                            </div>
                            <div id="response"></div>
                        </form>

</body>
</html>

this is my php code这是我的 php 代码

<?php
if (!isset($_POST["submit"]))
{
    echo "error; you need to submit the form";
}
$fname =$_POST["user-fname"];
$lname =$_POST["user-lname"];
$email =$_POST["user-lname"];
$phone =$_POST["user-lname"];
$message =$_POST["user-lname"];

if (empty($fname) || empty($lname) || empty($email) || empty($phone) || empty($message)){
    echo "please fill all the fields";
    exit;
}
else
{
    mail("email@gmail.com", "company Message", $message, "From: $fname <$email>");
    echo "<script type='text/javascript'>alert('Your message sent successfully');
    window.history.log(-1);
    </script>";
}
?>

when i am click on the submit button.it's taking me to send.php page but it's gives me an error which is given below.当我单击提交按钮时。它带我发送。php 页面,但它给了我一个错误,如下所示。 how can i solve it.我该如何解决。

This page isn't working If the problem continues, contact the site owner.此页面不工作 如果问题仍然存在,请联系网站所有者。 HTTP ERROR 405 HTTP 错误 405

Hi please change button name I think that is the problem in your code.嗨,请更改按钮名称,我认为这是您代码中的问题。

  <button type="submit" class="btn btn-info btn-lg btn--highlight contact_btn_u" id="submit-btn" name="submit">Send </button>
                  

暂无
暂无

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

相关问题 我的电子邮件无法使用,我的联系我们页面出现错误 - My Email is not working am getting error in my contact us page 与我们联系电子邮件php错误 - Contact us email php error 填写php表单发生错误时,我正尝试向自己发送电子邮件 - I am trying to send an email to myself when an error happens from filling out the php form 电子邮件未从我的PHP / html联系人表单发送 - Email doesn't send from my PHP/html contact form 我在 Login.php 页面中输入了正确的电子邮件 ID 和密码,但显示错误 - I am Entering Correct Email id and Password in my Login.php page, But Shows Error 我正在尝试使用 ajax POST 方法从 html 页面将数据发送到我的 PHP 页面,但它给出错误,注意:未定义索引: - I am trying to send data to my PHP page from html page using ajax POST method but it give error ,Notice: Undefined index: 我的联系人HTML页面重定向到我的联系人PHP,并且不发送电子邮件 - My contact HTML page redirects to my contact PHP and doesn't send email PHP:将电子邮件通知发送到我的电子邮件ID,如果在任何页面中发现500个内部错误 - PHP : Send Email Notification to my email id If 500 internal error found in any page 我正在尝试使用Zend Gdata库将文档从我的网站上载到Google文档,但出现以下错误 - I am trying to upload the document from my site to Google Docs using Zend Gdata library, but it gives below error 我在尝试发送电子邮件验证时遇到错误 - I am getting error while trying to send email verification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM