所以基本上我有一个包含多个项目的结帐页面,上面有一个复选框,让我们说你想要15个中的4个项目,当你检查那些特定项目被添加到发送的订单列表中时给你发邮件。
我还没有为复选框设置值,因为我试图弄清楚这一点。
它是一个文本墙,我知道。 jsFiddle对我提交的代码行为迟钝。
PHP $ _POST
$basic_standby = trim(htmlentities($_POST['basic_standby'], ENT_QUOTES));
$advanced_standby = trim(htmlentities($_POST['advanced_standby'], ENT_QUOTES));
$basic_game_overlay = trim(htmlentities($_POST['basic_game_overlay'], ENT_QUOTES));
$advanced_game_overlay = trim(htmlentities($_POST['advanced_game_overlay'], ENT_QUOTES));
$desktop_overlay = trim(htmlentities($_POST['desktop_overlay'], ENT_QUOTES));
$offline_overlay = trim(htmlentities($_POST['offline_overlay'], ENT_QUOTES));
$live_overlay = trim(htmlentities($_POST['live_overlay'], ENT_QUOTES));
$avatar_image = trim(htmlentities($_POST['avatar_image'], ENT_QUOTES));
$description_images = trim(htmlentities($_POST['description_images'], ENT_QUOTES));
$team_logo = trim(htmlentities($_POST['team_logo'], ENT_QUOTES));
$gold_package = trim(htmlentities($_POST['gold_package'], ENT_QUOTES));
$website_design = trim(htmlentities($_POST['website_design'], ENT_QUOTES));
邮件HTML / PHP
<table cellpadding="0" cellspacing="0" border="0" width="670" class="content">
<tr>
<td width="100"></td>
<td style="padding: 5px 0 20px 0; font-size: 13px;"><b style="text-transform: uppercase; font-size: 14px;">Order list:</b><br /><br /> '. $faster_delivery .'<br /> '. $basic_standby .'<br /> '. $advanced_standby .'<br /> '. $basic_game_overlay .'<br /> '. $advanced_game_overlay .'<br /> '. $desktop_overlay .'<br /> '. $offline_overlay .'<br /> '. $live_overlay .'<br /> '. $avatar_image .'<br /> '. $description_images .'<br /> '. $team_logo .'<br /> '. $gold_package .'<br /> '. $website_design .'</td>
<td width="100"></td>
</tr>
</table>
几个复选框 - HTML
<tr>
<td width="250">1x Basic standby overlay:</td>
<td width="15" align="left">
<input class="test" type="checkbox" name="basic_standby" value="0" data-val="10" />
</td>
</tr>
<tr>
<td width="250">1x Advanced standby overlay:</td>
<td width="15" align="left">
<input type="checkbox" name="advanced_standby" value="0" data-val="20" />
</td>
</tr>
<tr>
<td width="250">1x Basic game overlay:</td>
<td width="15" align="left">
<input type="checkbox" name="basic_game_overlay" value="0" data-val="10" />
</td>
</tr>
<tr>
<td width="250">1x Advanced game overlay:</td>
<td width="15" align="left">
<input type="checkbox" name="advanced_game_overlay" value="0" data-val="20" />
</td>
</tr>
我的错误消息
Notice: Undefined index: basic_standby in C:\xampp\htdocs\datoverlayguy\core\includes\send_order.php on line 44
Notice: Undefined variable: newsletter in C:\xampp\htdocs\datoverlayguy\core\includes\send_order.php on line 45
Notice: Undefined index: advanced_standby in C:\xampp\htdocs\datoverlayguy\core\includes\send_order.php on line 48
Notice: Undefined index: basic_game_overlay in C:\xampp\htdocs\datoverlayguy\core\includes\send_order.php on line 52
Notice: Undefined index: advanced_game_overlay in C:\xampp\htdocs\datoverlayguy\core\includes\send_order.php on line 56
Notice: Undefined index: offline_overlay in C:\xampp\htdocs\datoverlayguy\core\includes\send_order.php on line 64
Notice: Undefined index: live_overlay in C:\xampp\htdocs\datoverlayguy\core\includes\send_order.php on line 68
Notice: Undefined index: avatar_image in C:\xampp\htdocs\datoverlayguy\core\includes\send_order.php on line 72
Notice: Undefined index: description_images in C:\xampp\htdocs\datoverlayguy\core\includes\send_order.php on line 76
Notice: Undefined index: website_design in C:\xampp\htdocs\datoverlayguy\core\includes\send_order.php on line 88
修改
当我尝试发送电子邮件时,它会显示如下。
答案 0 :(得分:2)
我想我明白了......你将复选框的值设置为0。
意思是如果他们要检查,发送的值将是&#34; 0&#34; ....如果你不检查它们......值将是....等待它.....&#34; 0&#34;也被视为虚假。
你必须设置类似的东西:
如果你选中你可以选择的方框,那就行了:
if( isset($_POST['advanced_game_overlay']) )
$advanced_game_overlay = $_POST['advanced_game_overlay'];
然后您可以在表单中使用该变量,如果选中该复选框,则应显示1;如果不是,则显示0。试试吧,它可能会解决问题。在你的转储中,我们看到了价值&#34; sticka&#34;发送后,您的表单信息成功发送,您也重复使用&#34; name&#34;根据你的意见得出的结论,除了......之外我没有别的想法......