我有一个包含联系表单的html页面。我还没有使用验证码,但我试图了解为什么这段代码在进入之前没有工作。 所以,我的index.html有这样的形式:
<form id="quote-form" action="inc/sendmail.php" method="post">
<div class="sec-title text-center">
<h1>Request for Quote</h1>
<span class="border center"></span>
</div>
<div class="row">
<div class="col-md-12">
<input type="text" name="name" value="" placeholder="Your Name*" required="">
<input type="email" name="email" value="" placeholder="Your Mail*" required="">
<input type="text" name="phone" value="" placeholder="Your Phone*" required="">
<select class="selectmenu" name=message>
<option selected="selected">Select Service</option>
<option value="Need Quote on a product Alpha</option>
<option>Other</option>
</select>
<button class="thm-btn bg-clr1" type="submit">Get a Quote</button>
</div>
</div>
</form>
我的sendmail.php有以下代码:
<?php
if(isset($_POST['submit'])){
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$phone = $_POST['phone'];
$formcontent="From: $name \n Message: $message \n Email:$email \n Phone:$phone";
$recipient = "testname@gmail.com";
$subject = "Website Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Mail Sent. Thank you, we will contact you shortly.";
}
?>
答案 0 :(得分:1)
您还可以在提交按钮上添加名称属性。
在你的按钮上添加:
name='submit'
<button name='submit' class="thm-btn bg-clr1" type="submit">Get a Quote</button>
原因是name属性是添加到$_POST
数组的内容。出于学习目的,请执行var_dump($_POST);
,然后您就会看到结果
答案 1 :(得分:-1)
根据你上面的评论。
更改
library(dplyr)
library(tidytext)
library(widyr)
df <- data_frame(Id = rep(1:5, each = 2),
Text = c("a", "b",
"a", "c",
"a", "c",
"b", "e",
"b", "f"))
#define function
rm_main = function(data)
{
if(is.data.frame(data)){
test <- data %>%
pairwise_count(Text, Id)
}
print(data)
return(list(data))
}
#call function now
rm_main(df)
到
if(isset($_POST['submit'])){