我正在尝试创建邮件表单,但我希望邮件根据他们注册时提供的电子邮件地址发送给不同的人。
我如何用<?php echo $row_DetailRS1['email']; ?>
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$name = $_REQUEST['name'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail("example@live.co.uk", $subject,
$message, "From:" . $email);
echo "Thank you for using our mail form";
}
else
//if "email" is not filled out, display the form
{
echo"<form method='post' action='../index.php#contact'>
<input type='text' name='name' class='cform' placeholder='Name...'>
<input type='email' name='email' class='cform' placeholder='Email...'>
<input type='text' name='subject' class='cform' placeholder='Subject...'>
<textarea name='message' id='message' class='txtarea'></textarea>
<input class='buttonform'type='submit'>
</form>";
}
?>
答案 0 :(得分:1)
为什么不能用变量替换"example@live.co.uk"
?
mail($row_DetailRS1['email'], $subject, $message, "From:" . $email);