1

我有一个看起来像这样的表格

<form action="send_attach_pear.php" type="POST" enctype="multipart/form-data">
<p>Name: <input type="text" name="name" id="name" /></p>
<input type="submit">
</form>

将信息发送到 PHP 文件...

require 'class.phpmailer.php';

$name = $_POST['name'];

//Create a new PHPMailer instance
$mail = new PHPMailer();
$mail->setFrom('from@example.com', 'First Last');
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('zacharycook2014@utexas.edu', 'Zach Cook');
$mail->Subject = 'PHPMailer mail() test';
$mail->isHTML(true);
$msg = "This is a message from " . $name . ".";             
$mail->Body = $msg;

但由于某种原因,“$name”没有出现在最后的电子邮件中。

你知道出了什么问题吗?

4

1 回答 1

3

method=POST不是type=POST

这是代码:

<form action="send_attach_pear.php" method="POST" enctype="multipart/form-data">
于 2013-10-19T06:41:47.090 回答