简体   繁体   English

需要有关$ _POST在PHP中的帮助

[英]need help regarding $_POST in PHP

I have a problem with my piece of code, kindly let me know where exactly I went wrong. 我的一段代码有问题,请让我知道我哪里出错了。 I am sending an email to my account and the error I get is ... that I get only half of the information. 我正在向我的帐户发送电子邮件,但收到的错误是...我仅获得一半的信息。

To get a clear idea of what I am asking I am attaching the code below. 为了清楚了解我要问的内容,请附上以下代码。

<?php

$first_name = $_POST["name_t"] ;
$last_name = $_POST["lname_t"] ;
$contact=$_POST["contact"] ;
$email = $_POST["email"] ;
$adults =$_POST["no_adults_t"] ;
$children = $_POST["no_children"] ;
$address = $_POST["address"] ;
$date = $_POST["date_t"] ;
$message = "First Name : ".$first_name."\n\nLast Name : ".$last_name."\n\nContact Number : ".$contact."\n\nAddress :".$address."\n\nE mail :".$email."\n\n  Number Of Adults : ".$adults."\n\nNumber Of children : ".$children."\n\nReservation Date : ".$date;

$headers = "From:" . $email;
@mail( "someone@someone.com", "some subject ",$message,$headers);

echo "<pre>".print_r($_REQUEST, 1)."</pre>";
print $first_name;
print $last_name;
print $contact;
print $email;
print $adults;
print $children;
print $address;
print $date;

print "<body style="."background-color:gray"."></body>
<h2 style="."color:maroon;".">Thank You.Your information has been submitted.Our Representative would be contacting you shortly</h2>
<h4 style="."color:blue"."><a href="."index.html".">Click Here To Go Back to Main Page.</a></h4>"
?>

尝试使用SMTP发送(http://phpmailer.worxware.com/)

Refer this link:- http://www.w3schools.com/php/php_mail.asp , Also first use this "var_dump($_POST);" 请参阅此链接:-http: //www.w3schools.com/php/php_mail.asp ,也请首先使用此“ var_dump($ _ POST);” and check whether you are getting all values or not. 并检查您是否正在获取所有值。 I think email function not work on localhost. 我认为电子邮件功能不适用于localhost。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM