我有一个将用户输入值邮寄到电子邮件地址的联系表格。它工作得很好,它发送了除主题之外的所有信息,我已将其作为一个带有几个选项的下拉框呈现。我希望将所选选项设置为电子邮件主题。
<select name="subject">
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<?php
$email = $_POST['email'];
$message = $_POST['message'];
$name = $_POST['name'];
$subject = $_POST['subject'];
$phone = $_POST['phone'];
$to = 'emailaddress.co.uk';
$from = $email;
$header = "From:" . $from;
$msgsubject = "$subject message from $name";
$commessage = "Name: $name
Email: $email
Phone Number: $phone
Subject: $subject
Message: $message";
mail($to, $msgsubject, $commessage, $header);
?>