任何人都可以帮助解决我无法理解的表单问题吗?我有一组复选框,其值无法显示在生成的邮件中。
这是我用来设置变量的方法:
$benefit01 = ($_POST['benefit_01']);
$benefit02 = ($_POST['benefit_02']);
$benefit03 = ($_POST['benefit_03']);
$benefit04 = ($_POST['benefit_04']);
$benefit05 = ($_POST['benefit_05']);
$benefit06 = ($_POST['benefit_06']);
$property = addslashes($_POST['property']);
$owner = addslashes($_POST['owner']);
$mainHeating = addslashes($_POST['Heating_mainHeating_answer']);
$boiler_working = addslashes($_POST['boiler_working']);
$boiler_age = addslashes($_POST['boiler_age']);
$postcode = addslashes($_POST['postcode']);
$address1 = addslashes($_POST['address1']);
$address2 = addslashes($_POST['address2']);
$address3 = addslashes($_POST['address3']);
$city = addslashes($_POST['town']);
$county = addslashes($_POST['county']);
$name = addslashes($_POST['firstName']);
$surname = addslashes($_POST['surname']);
$email = addslashes($_POST['email']);
$phone = addslashes($_POST['phonenum']);
$type = addslashes($_POST['type']);
$time = $_POST['time'];
$src = $_POST['urlsrc'] ;
$benefits = $benefit01." ".$benefit02." ".$benefit03." ".$benefit04." ".$benefit05." ".$benefit06;
$address = $address1." ".$address2;
$note = "Benefits: ".$benefits.". Property Type: ".$property.". Home Owner: ".$owner.". Type of Heating: ".$mainHeating.". Boiler Working: ".$boiler_working.". Boiler Age: ".$boiler_age.". Timescales: ".$time.". Address Line 3: ".$address3;
所以“好处”是复选框。我曾尝试将它们都命名为相同的名称以创建一个数组,然后将这些值内爆,但这也不起作用。最终,这些数据被发送到数据库,这就是为什么大部分信息都被转储到 $note 变量中的原因。
我对此知之甚少,并从一个工作(尽管是简化的)表单中获取了这个示例。任何帮助表示赞赏。
** 下面添加的表格小样本:
<input name="ctl00_chkBenefit" type="checkbox" id="benefit_01" class="checkbox-benefit" value="Child Tax Credit" />
儿童税收抵免(相关收入为 15,860 英镑或以下)
<input name="ctl01_chkBenefit" type="checkbox" id="benefit_02" class="checkbox-benefit" value="State Pension Credit" />
国家养老金信贷