这是我第一次制作表单,我有多项选择选项,但我认为我错过了一些东西,因为表单正在运行,但在选择多个选项时,我收到的电子邮件仅显示 1 个选项。
<form action="send.php" method="POST">
<p>Name</p> <input type="text" name="name">
<p>Email</p> <input type="text" name="email">
<p>Services</p>
<select data-placeholder="Responsible For...." multiple class="chosen-select full_width" name="service" tabindex="-1">
<option value="Medical">Medical</option>
<option value="Finance">Finance</option>
<option value="Construction">Construction</option>
<option value="IT Services">IT Services</option>
</select>
<p>Message</p><textarea name="message" rows="6" cols="25"></textarea><br />
<input type="submit" value="Send"><input type="reset" value="Clear">
</form>
发送.php
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$service = $_POST['service'];
$message = $_POST['message'];
$formcontent=" From: $name \n Type: $service \n Message: $message";
$recipient = "itssonu4564@gmail.com";
$subject = "Message";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>
喵喔喔
冉冉说