当我在弹出的提交按钮上发送电子邮件时,我使用if(isset($_POST['submit']))
,但它没有取值。
在提交按钮上,告诉我这段代码中的问题是什么,它不接受提交作为isset post。
在if函数中,没有输入值的提交按钮也解释了是否存在jquery问题
<?php
//print_r($_POST);die();
ini_set('display_errors', 'On');
if(isset($_POST['submit'])){
$to = "basavraj.p@wepearl.in"; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$first_name = trim($_POST['fname']);
/*$last_name = $_POST['last_name'];*/
$email = trim($_POST['email']);
$phone_number = trim($_POST['phone-number']);
$subject = trim($_POST['subject']);
$description = trim($_POST['description']);
$quote_sub = trim($_POST['quote-sub']);
$message = "First Name: ".$first_name."\r\n Email: ".$email." \r\n Phone Number: ".$phone_number." \r\n Subject: ".$subject." \r\n Description: ".$description." " ;
$headers = "From: kashmira.s@wepearl.in" . "\r\n" .
"CC: pooja.s@wepearl.in";
/*$headers2 = "From:" . $to;*/
if(mail($to,$quote_sub,$message,$headers))
{
echo "success";
}
else
{
echo "failed";
}
}
?>
答案 0 :(得分:0)
我认为您的查询
if(isset($_POST['submit'])){
失败,因为您可能未在name="submit"
声明中添加<input type="submit" />
,或者您可能还有其他名称。
所以,添加
<input type="submit" name="submit" value="Go!" />
在您的html
页面中。在php中,只需检查表单是否已提交,
if(isset($_POST['submit'])){
要检查,只需通过
回显提交的数据if(isset($_POST['submit']))
{
$from = $_POST['email'];
echo "From email : " . $from;
/ ..add rest here like name.../