我目前有一些php,可在完成时将表格发送给电子邮件。问题是,我希望在必须选择两个选项而不是所有选项时提交表单。
该表单是具有5个选项的基本输入表单,其中2个是必需的。
<?php
///I thought this would work since I'm only requesting two inputs V
if (isset($_POST['optionOne']) && isset($_POST['option'])){
$optionOne=$_POST['optionOne'];
$tick=$_POST['tick'];
$results=$_POST['results'];
$option=$_POST['option'];
$requirements=$_POST['requirements'];
$to= "bonniethompson12345@gmail.com";
$subject="submit";
$body="This course is identified in my Work Plan and Learning Agreement: $optionOne \n \n I am attending this session because: $tick \n \n What would you like to achieve as a result of your attendance: $results \n \n Do you require adjustments or additions to the session delivery to support your participation: $option \n \n Please provide details of your requirments: $requirements";
$send = mail($to, $subject, $body);
if ($send) {
echo 'message sent!';
}else {
echo "error";
}
}
?>