Reputation: 134
So basically I got a checkout page with multiple items with a checkbox on it, Let's say you want 4 items out of 15, when you check those boxes those specific items get added to the order list that gets sent to you mail.
I haven't set a value to the checkboxes yet because I'm trying to figure this out.
It's a wall of text, I know that. jsFiddle is acting retarded to the code I'm submiting.
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));
Mail 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>
Few checkboxes - 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>
My error message
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
EDIT
When I try to send the email It shows like this.
Upvotes: 0
Views: 96
Reputation: 478
I think i get it....you set the values of your checkboxes to 0.
Meaning if they're check, the value sent will be "0"....if you don't check them....the value will be....wait for it....."0" also considered as false.
You have to set something like that :
That's way if you check the box you can do :
if( isset($_POST['advanced_game_overlay']) )
$advanced_game_overlay = $_POST['advanced_game_overlay'];
And then you can use the variable in your form, it should display 1 if the box is checked, 0 if it's not. Try it, it might solve the issue. In your dump we see the value "sticka" which is sent so your form informations are successfuly sent, you also reuse the "name" attrib from your inputs so there's nothing else i can think of except that...
Upvotes: 2