-2
我是一名PHP編程初學者。我正在一個沙龍的網站上工作,該網站有一個表單,用戶可以通過發送電子郵件的方式預約約會,我正在嘗試從HTML表單中的多個選擇框中發送值,並將該數據與電子郵件中的其他字段。其他領域發佈罰款。但選擇框不起作用。下面是我正在使用的代碼:使用HTML表單中的多個選擇框
<?php
$clnt_name = $_POST['w_p_c_name'];
$clnt_email = $_POST['w_p_c_email'];
$clnt_phn_no = $_POST['w_p_c_number'];
$rsrvtn_date = $_POST['w_p_c_date'];
$hair_cut = $POST['opt_hair_cut'];
$colr_whl_hair = $POST['opt_colouring_whole_hair'];
$colr_retouch = $POST['opt_colouring_retouch_roots'];
$colr_highlight = $POST['opt_colouring_highlighting'];
$rebonding = $POST['opt_rebonding'];
$relax_straight = $POST['opt_relaxing_straightening'];
$perming = $POST['opt_perming'];
$threading = $POST['opt_threading'];
$bleaching = $POST['opt_bleaching'];
$manicure = $POST['opt_manicure'];
$pedicure = $POST['opt_pedicure'];
$nail = $POST['opt_nail'];
$gel_nail = $POST['opt_gel_nail'];
$massage = $POST['opt_massage'];
$scrub = $POST['opt_scrub'];
$wax_face = $POST['opt_wax_face'];
$wax_arms = $POST['opt_wax_arms'];
$wax_leg = $POST['opt_wax_leg'];
$wax_body = $POST['opt_wax_body'];
$wax_intimate = $POST['opt_wax_intimate'];
$makeup = $POST['opt_makeup'];
$hijab = $POST['opt_hijab'];
$hairstyle_blodry = $POST['opt_hairstyle_blowdry'];
$hairstyle_iron = $POST['opt_hairstyle_iron'];
$hairstyle_spcl = $POST['opt_hairstyle_special'];
$hair_trmnt = $POST['opt_hair_treatment'];
$face_cleaning = $POST['opt_face_cleaning'];
$facials = $POST['opt_facials'];
$face_trmnt = $POST['opt_face_treatments'];
$scrub_ladies = $POST['opt_scrubs_ladies'];
$massage_ladies = $POST['opt_massage_ladies'];
$data = "Name : ".$clnt_name."\nEmail : ".$clnt_email."\nPhone : ".$clnt_phn_no."\nRequested Date : ".$rsrvtn_date."\nServices Requested :\n\n".$hair_cut."\n".$colr_whl_hair."\n".$colr_retouch."\n".$colr_highlight."\n".$rebonding."\n".$relax_straight."\n".$perming."\n".$threading."\n".$bleaching."\n".$manicure."\n".$pedicure."\n".$nail."\n".$gel_nail."\n".$massage."\n".$scrub."\n".$wax_face."\n".$wax_arms."\n".$wax_leg."\n".$wax_body."\n".$wax_intimate."\n".$makeup."\n".$hijab."\n".$hairstyle_blodry."\n".$hairstyle_iron."\n".$hairstyle_spcl."\n".$hair_trmnt."\n".$face_cleaning."\n".$facials."\n".$face_trmnt."\n".$scrub_ladies."\n".$massage_ladies;
$file = "services.xlxs";
$subject = "Reservation Booking";
$mail_message1 = "Hi ".$clnt_name." We have received your request for a reservation with the following details.\n\n".$data."\n\nWe will be calling to confirm the reservation shortly.\n\nThank you";
$to_rsvtn = "[email protected]";
$subject2 = "Reservation";
$mail_message2 = "There has been a new request for a reservation. Details are listed below: \n\n".$data;
file_put_contents($file, $data1 . PHP_EOL, FILE_APPEND);
file_put_contents($file, $data2 . PHP_EOL, FILE_APPEND);
file_put_contents($file, $data3 . PHP_EOL, FILE_APPEND);
mail($clnt_email, $subject, $mail_message1, "From:" . $to_rsvtn);
mail($to_rsvtn, $subject2, $mail_message2, "From:" . $to_rsvtn);
header('Location: ba-complete.html');
?>
任何幫助,非常感謝。
你可以請張貼html代碼嗎? –
如果未選中複選框,則不會發送該值。您的服務器需要將複選框設置爲值或空值,具體取決於是否通過值 – mplungjan
*「其他字段的POST正常。」* - 我發現很難相信,看到很多'$ POST',這是無效的。 –