Hi I am simply trying to post a form data to my mail.php file, but my php file doesn't get any post data. It shows blank. tried almost all stuffs but still the problem exists. here is my html form and php mail script.
<form action="assets/mail/mail.php" method="post">
<fieldset class="clearfix" style="margin-left:10px;margin-top:10px;">
<input name="key" type="hidden" value="AAFM">
<p style="padding:0px;"><span class="fontawesome-user"></span>
<input name="MasterInner_txtName" id="MasterInner_txtName" type="text" placeholder="Name" required>
</p>
<!-- JS because of IE support; better: placeholder="Username" -->
<p style="padding:0px;"><span class="fontawesome-phone"></span>
<input name="MasterInner_txtMobile" id="MasterInner_txtMobile" type="text" placeholder="Phone" required>
</p>
<!-- JS because of IE support; better: placeholder="Username" -->
<p style="padding:0px;"><span class="fontawesome-envelope"></span>
<input name="MasterInner_txtEmail" id="MasterInner_txtEmail" type="text" placeholder="Email" required>
</p>
<!-- JS because of IE support; better: placeholder="Username" -->
<p style="padding:0px;"><span class="fa fa-home"></span>
<input name="MasterInner_txtCity" id="MasterInner_txtCity" type="text" placeholder="City" required>
</p>
<!-- JS because of IE support; better: placeholder="Username" -->
<p style="padding:0px;">
<textarea name="MasterInner_txtRemarks" id="MasterInner_txtRemarks" placeholder="Remarks" required></textarea>
</p>
<!-- JS because of IE support; better: placeholder="Username" -->
<p style="padding:0px;">
<input name="MasterInner_submit" id="submitformbtn" Class="form-button" type="submit" value="Submit">
</p>
</fieldset>
</form>
and here is my php code
<?php
require_once('class.phpmailer.php');
include("class.smtp.php");
//date_default_timezone_set('Etc/UTC');
/*if($_SERVER["REQUEST_METHOD"] == "POST")
{*/
print_r($_POST);
echo "</br>";
print "CONTENT_TYPE: " . $_SERVER['CONTENT_TYPE'] . "<BR />";
$data = file_get_contents('php://input');
print "DATA: <pre>";
var_dump($data);
var_dump($_POST);
print "</pre>";
//phpinfo();
echo "</br></br>";
if(isset($_POST['MasterInner_submit']))
$name = $_POST["MasterInner_txtName"];
$phone = $_POST["MasterInner_txtMobile"];
$msg = $_POST["MasterInner_txtRemarks"];
$mcity = $_POST["MasterInner_txtCity"];
$email = $_POST["MasterInner_txtEmail"];
$key =$_POST["key"];
echo "name=".$name;
$subject = "Mr ".$name." has Submitted form From Website";
$body = "Name: ".$name."
Email: ".$email."
Contact No: ".$phone."
City: ".$mcity."
ENQUIRY: ".$msg;
$msg='<div class="alert_success" >Thanks for your queries, our team will get back to you.</div>';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 0;
//$mail->Debugoutput = 'html';
$mail->Host = 'smtp.XYZ.com';
$mail->Port = 25;
$mail->SMTPSecure = '';
$mail->SMTPAuth = true;
$mail->Username = "sendermail@syz.com";
$mail->Password = "*****";
$mail->setFrom('sendermail@syz.com', 'MART');
$mail->addAddress('mymail@gmail.com', 'SAM.');
$mail->addBCC('xy@test.com', 'SSAM.');
$mail->Subject = "Mr ".$name.' has Submitted form From Website';
$mail->Body = $body;
echo "email = ".$email;
//if (!$mail->send()) {echo "Mailer Error: " . $mail->ErrorInfo;}
//else {echo $msg;}
if ($mail->send()) {echo $msg;} //header("location:index.html");}
echo "phone = ".$phone;
//}
//}
?>
Please help
</div>