0
我正在創建一個具有單選按鈕,複選框和文本區域字段的聯繫表單。當我點擊提交按鈕時,我會收到我的電子郵件中的所有值除了複選框。以下附件是我的PHP和HTML代碼片段,請協助?當檢查發送多個複選框數組到電子郵件
<?php
//INITIALIZE VARIABLES and set to empty values
$checkbox = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Check the values from checkbox and POST them to email
if(!empty($_POST["checkbox"])) //check if the user has selected a CHECKBOX or NOT
{
$checkbox =$_POST["checkbox"]; //Array of values from the checkbox
foreach($checkbox as $value) //loop to store and display values of individual checkboxes
{echo $value;}} //Display selected checkbox
else {test_input($_POST["value"]);} //POST values to email
//HTML CODE
What project would you like for your business venture? <span class= "error"> * </span>
<br> <br> <input type="checkbox" class="input" name="checkbox[]" value="Graphics Design"> Graphics Design (Book, Posters, Flyers, Banners, Magazines, T-Shirts) <br>
<input type="checkbox" class="input" name="checkbox[]" value="Logo Design"> Professional logo Design <br>
<input type="checkbox" class="input" name="checkbox[]" value="Branding"> Branding <br>
<input type="checkbox" class="input" name="checkbox[]" value="Digital Marketing" > Digital Marketing (Social-Media Marketing, E-Mail Marketing & SEO)
<button class="submit" type= "reset" value= "Reset"> Reset Form </button>
<button class="submit" type= "submit" value= "Submit"> Submit Form </button>
複選框,纔會發送。 – PeeHaa
要發送電子郵件的哪些功能,請至少分享一行。 – C2486