Hello guys,

I'm new to this board. I just signed up because I have a issue with something I can't get to work. I really don't know how to handle it. I hope someone with amazing PHP skills can help me out. I trust one you guys

Ok, I made a script with orders in it from our customers. That placed a order, and the database will be filled. A script show the rows from a database. Every row has a checkbox in front of the row. When you select the checkbox and press submit that specified row will disappear from the list and a automatic email has been sent to the customer that his/her order has been shipped. Everything works fine. The script sends a email and a text message to the customer.

Well, sometimes a customer orders 2 or more things. Now the customers get 2 or 3 emails and text message that their products are send out. I want to combine the products in 1 email. So instead of 3 separated emails, I only want the script to send out 1 with all 3 products in it. If a customer only has one product, the script has just to send out a email with 1 product inside.

The "wpos" value is the order number, so i need something that check for the "wpos" value and combine all together in 1 email incl product descriptions. Do you think something like this is possible? I'm busy to think of a way for 1.5 week now till deep in the night but can't get it to work.

Here is my PHP code
PHP Code:

include 'mysql.php';

$_POST['checkbox'])){$checkbox $_POST['checkbox'];
$_POST['activate'])?$activate $_POST["activate"]:$deactivate $_POST["deactivate"])
$id "('" implode"','"$checkbox ) . "');" ;
$sql="UPDATE table_name SET closed = '".(isset($activate)?'yes':'no')."' WHERE id IN $id;
$result mysql_query($sql) or die(mysql_error());

$sql="SELECT * FROM table_name WHERE closed='yes' AND id IN $id";


// script for sending out mime emails and text messages on cellphone taken out
// using $rows[values] for reading the database


$sql="SELECT * FROM table_name WHERE closed = 'no' AND handled = 'yes' ORDER BY wpos ASC";



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<title>Openstaande web orders</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" type="text/css" href="smartDark.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="pragma" content="no-cache" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="javascript/jquery.toastmessage.js" type="text/javascript"></script>
<link href="resources/css/jquery.toastmessage.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
function un_check(){
for (var i = 0; i < document.frmactive.elements.length; i++) {
var e = document.frmactive.elements[i];
if ((e.name != 'allbox') && (e.type == 'checkbox')) {
e.checked = document.frmactive.allbox.checked;

<form name="frmactive" method="post" action="">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<table border="0" cellpadding="4" cellspacing="1" class="forumline" align="center" width="1380" height="50">
<td colspan="2" class="catBottom" nowrap="nowrap" align="left" valign="center">&nbsp;<span class="postbody"><font color="#9A9999"><b>Locatie: <i>Verstuur Ontvangstbevestiging - <?php echo $filiaal ?></b></i></font></span></td>

<table cellpadding="4" cellspacing="1" width="650"  align="center">
<td class="row2" width="130" align="right" valign="top"></td>
<td width="644" class="row2"><span class="postbody" valign="top" align="left">&nbsp;</td>

<table cellpadding="4" cellspacing="1" class="forumline" align="center" >
<td class="row2" width="23" align="center" valign="middle"><span class="postbody"><input type="checkbox" name="allbox" title="Select of Deselect alles" onclick="un_check()";/></span></td>
<td class="row2" width="55" align="center" valign="middle"><span class="postbody"><b>BRAM</b></span></td>
<td class="row2" width="55" align="center" valign="middle"><span class="postbody"><b>WPOS</b></span></td>
<td class="row2" width="135" align="center" valign="middle"><span class="postbody"><b>Order Datum / Tijd</b></span></td>
<td class="row2" width="370" align="left" valign="middle">&nbsp;<span class="postbody"><b>Artikel Omschrijving</b></span></td>
<td class="row2" width="20" align="center" valign="middle">&nbsp;<span class="postbody"><b>#</b></span></td>
<td class="row2" width="300" align="left" valign="middle">&nbsp;<span class="postbody"><b>Klant Naam / Bedrijfsnaam</b></span></td>
<td class="row2" width="90" align="left" valign="middle">&nbsp;<span class="postbody"><b>Mobiel</b></span></td>
<td class="row2" width="250" align="left" valign="middle">&nbsp;<span class="postbody"><b>E-Mail adres</b></span></td>


<table cellpadding="4" cellspacing="1" class="forumline" align="center">
<td class="row2" width="23" align="center" valign="middle"><span class="postbody"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></span></td>
<td class="row2" width="55" align="center" valign="middle"><span class="postbody"><?php echo $rows[bram?></span></td>
<td class="row2" width="55" align="center" valign="middle"><span class="postbody"><?php echo $rows[wpos?></span></td>
<td class="row2" width="135" align="center" valign="middle"><span class="postbody"><?php echo $rows[aanmaaktijd?></span></td>
<td class="row2" width="370" align="left" valign="middle">&nbsp;<span class="postbody">[<?php echo $rows[custom_item_nummer?><?php echo $rows[beschrijving?></span></td>
<td class="row2" width="20" align="center" valign="middle"><span class="postbody"><?php echo $rows[aantal?></span></td>
<td class="row2" width="300" align="left" valign="middle">&nbsp;<span class="postbody"><?php echo $rows[klant_naam?></span></td>
<td class="row2" width="90" align="left" valign="middle">&nbsp;<span class="postbody"><?php echo $rows[mobiel_nummer?></span></td>
<td class="row2" width="250" align="left" valign="middle">&nbsp;<span class="postbody"><?php echo $rows[klant_email?></span></td>

<?php ?>


<table border="0" cellpadding="4" cellspacing="1" align="center" width="1380">
<td colspan="1" nowrap="nowrap" align="left" valign="center">&nbsp;<span class="postbody"><input name="activate" type="submit" id="activate" value="Send notification" />&nbsp;&nbsp;<input name="deactivate" type="submit" id="deactivate" value="remove order" onclick="return confirm('are you sure you want to remove the order?')"/></span></td>




header('Location: http://website.com/index.php');


Hope someone can help me out. If you have questions, please let me know!
Thanks in advanced!

Marco Pavone