电子邮件表单字段数组


Email form fields array

谁可以使用电子邮件表单字段数组创建数组。

 if(isset($_POST['submit'])){
        $content=array(
        $name=$this->strip_tags($_POST['name']),
        $email=$this->strip_tags($_POST['email']),
        $phone=$this->strip_tags($_POST['phone']),
        $address=$this->strip_tags($_POST['address']),
        $city=$this->strip_tags($_POST['city']),
        $subject=$this->strip_tags($_POST['subject']),
        $message=$this->strip_tags($_POST['message'])
        );

然后使用邮件功能发送。

提前谢谢你

你可以这样做,这要容易得多:

if(isset($_POST['submit'])) {
$to = "someone@example.com"; // send email to
$from = "Your Name <you@example.com>"; // send email from
$subject = "Form submitted"; // email subject
$body = "The form has been submitted!
Here's the form data that was submitted.
Name: ".$_POST['name']."
Email: ".$_POST['email']."
Phone: ".$_POST['phone']."
Address: ".$_POST['address']."
City: ".$_POST['city']."
Subject: ".$_POST['subject']."
Message:
".$_POST['message']."
Some other text under the form data here...";
$email = mail($to, $subject, $body, "From: $from");
if($email) { // you don't actually need this, it's just to make sure it sends :)
echo "Email sent successfully";
}
}

这将发送一封电子邮件,其中包含提交的表单数据。

我希望这有帮助!