Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我无法通过php发送表单输入_Php_Html_Email_Input_Send - Fatal编程技术网

我无法通过php发送表单输入

我无法通过php发送表单输入,php,html,email,input,send,Php,Html,Email,Input,Send,所以,我有这个代码,无法发送输入到我的电子邮件,我如何才能解决这个问题? 我尝试了数百万种方法,但仍然无法解决这个问题,我看了很多视频和教程,但我认为问题出在我的代码中。 我怎样才能使这个代码工作 <form action="email_handler.php"> <div class="subscribe-form"> <h2 class="heading">Check your compatibility with your fa

所以,我有这个代码,无法发送输入到我的电子邮件,我如何才能解决这个问题? 我尝试了数百万种方法,但仍然无法解决这个问题,我看了很多视频和教程,但我认为问题出在我的代码中。 我怎样才能使这个代码工作

 <form action="email_handler.php">
    <div class="subscribe-form">
        <h2 class="heading">Check your compatibility with your favorite person </h2>
        <div class="grid grid--gutter-small grid--auto-sizing">

            <div class="grid  grid__item">
                <label for="firstName">Your name</label>
                <input action="mailto:nersisyan21@mail.ru" id="mynum" placeholder="Name" class="input" type="text"  name="name1" required />
            </div>

            <div class="grid  grid__item">
                <label for="lastName">Your surname</label>
                <input id="mynum1" placeholder="Surname" class="input" type="text" name="name2" required/>
            </div>

            <div class="grid  grid__item">
                <label for="lastName">His/Her name</label>
                <input id="mynum2" placeholder="Name" class="input" type="text" name="name3" required />
            </div>

            <div class="grid  grid__item">
                <label for="lastName">His/Her surname</label>
                <input id="mynum3" placeholder="Surname" class="input" type="text" name="name4" required />
            </div>




            <div class="grid grid__item">
                <button type="button" id="check" class="button" name="submit">Check</button>
            </div>

            <div class="grid grid__item">
                    <div class="out">
                        <p class="name2" id="out"></p>
                    </div>
                    </div>
        </div>
    </div>
    </form>
<?php  
    if(isset($_POST['submit'])){
        $name=$_POST['name'];
        $name1=$_POST['name1'];
        $name2=$_POST['name2'];
        $name3=$_POST['name3'];


        $to='example@example.com';
        $subject='Sovmestimost';
        $message="Name: ".$name."\n"."Surname: ".$name1."\n"."His/her name:      ".$name2."\n"."His/her second name: ".$name3;
        $headers="From: ".$name;
    }
?>

检查您与最喜欢的人的兼容性
你的名字
你姓什么
他/她的名字
他/她的姓氏
检查


表单中缺少方法属性

<form action="email_handler.php" method ="post">


您是否尝试过实际发送邮件?因为你的问题不在代码中。表单的默认发送方法是GET,而不是POST。您没有在表单标记中指定POST方法,因此它将使用GET。
name=“name4”必填项
-因此您以后不使用该方法,它将到此为止。@johncode在Php文件中他使用了POST方法我尝试过,但没有work@TaronNersisyanOP中没有触发邮件发送的任何代码。。只是一些构造头像的东西那么,我该怎么做呢,请帮忙