已經用PHP構建了一個功能表單,但是我有一個包含5個選項的複選框(可以選擇多於1個),但是隻有1個選項出現在電子郵件中。PHP表單上的多個複選框選項
HTML:
<label class="radio"><input type="checkbox" name="service" value="Web Design" />Web Design</label>
<label class="radio"><input type="checkbox" name="service" value="Graphic Design" />Graphic Design</label>
<label class="radio"><input type="checkbox" name="service" value="Brand Identity" />Brand Identity</label>
<label class="radio"><input type="checkbox" name="service" value="Online Marketing" />Online Marketing</label>
<label class="radio"><input type="checkbox" name="service" value="Other" />Other</label>
PHP:($服務)
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$website = $_POST['website'];
$service = $_POST['service'];
$description = $_POST['description'];
$inspiration = $_POST['inspiration'];
$budget = $_POST['budget'];
$deadline = $_POST['deadline'];
$formcontent=" From: $name \n Email: $email \n Phone: $phone \n Website: $website \n\n service: $service \n budget: $budget \n deadline: $deadline \n\n description: $description \n\n inspiration: $inspiration ";
$recipient = "[email protected]";
$subject = "Contact form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You, your information has been received.";
?>
這工作完美。謝謝大家的快速響應! –