在Wordpress中使用AMP插件时,Form Post Method无效

时间:2018-04-27 12:32:40

标签: php wordpress

我在我的网站上使用AMP插件。

我为另一个页面创建了自定义模板。我们有一个表格来提交数据。但是当我点击提交按钮时,没有执行任何操作。我在邮件中收到一个空白值。我在控制台中收到以下错误 -

Error: Only XHR based (via action-xhr attribute) submissions are support for POST requests

我在google上搜索并添加了action-xhr而不是表单操作。但它没有任何帮助

找到以下代码,



<?php
if(isset( $_POST['hosting']))
    $hosting = $_POST['hosting'];
if(isset( $_POST['email']))
    $email = $_POST['email'];

$content="\n Hosting : $hosting \n
  Email: $email \n
  
$recipients = array(
                "tejas@gmail.com"
            );
$to = implode(',', $recipients);
$mailheader = "From: $email \r\n";
mail($to, $subject, $content, $mailheader) or die("Error!");

?>

<form name="myForm" id="myform" method="POST" onsubmit="alert('Message has been sent');">
    <input required data-map-to="hosting_id_autocomplete" name="hosting_id" value="" aria-required="true" type="hidden" required/>
    <input placeholder="Email" name="email" class="large_input formemail " required aria-required="true" aria-invalid="false" type="email" required/>
    --
    <input type="submit" class="button arial grey orange" name="submit" >
    </form>
    
&#13;
&#13;
&#13;

你能告诉我这是什么问题吗?

由于

0 个答案:

没有答案