Forum Moderators: coopster
All items are then listed in a form with a function called showCart(). This part works perfect. Within the form users can then fill in other stuff like name, email, company name and submit the whole bunch the a predefined email address.
I am struggling to get the form data sent including the data from the function showCart to the defined email address.
Thank you guys for any help.
***********************
The form:
<form action="slimtec-schedule" method="post">
<table width="968" border="1" cellpadding="3" cellspacing="3" id="schedule_table">
<tr>
<td height="45" colspan="2" align="center">PROJECT NAME</td>
<td colspan="2" align="center">COMPANY</td>
<td align="center">CONTACT NAME</td>
<td align="center">CONTACT EMAIL</td>
<td align="center">PRINT</td>
</tr>
<tr>
<td colspan="2" align="center"><input name="project" type="text" id="project" size="30" maxlength="50" /></td>
<td colspan="2" align="center"><input name="company" type="text" id="company" size="30" maxlength="50" /></td>
<td align="center"><input name="name" type="text" id="name" size="20" maxlength="30" /></td>
<td align="center"><input name="email" type="text" id="email" size="30" maxlength="50" /></td>
<td align="center"> </td>
</tr>
<tr>
<td colspan="7" align="center"> </td>
</tr>
<tr>
<td width="90" align="center">Quantity</td>
<td width="84" align="center">Model</td>
<td width="111" align="center">Maximum Airflow</td>
<td width="110" align="center">Minimum Airflow</td>
<td width="186" align="center"> </td>
<td width="183" align="center"> </td>
<td width="227" align="center"> </td>
</tr>
<tr>
<td colspan="7"><?php echo showCart(); ?></td>
</tr>
</table>
<input type="submit" name="request" id="request" value="Request Quote" /></form>
**************************************
and here is the function showCart():
function showCart() {
$cart = $_SESSION['cart'];
if ($cart) {
$items = explode(',',$cart);
$contents = array();
foreach ($items as $item) {
$contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1;
}
$output[] = '<table width="800">';
foreach ($contents as $id=>$qty) {
$query = 'SELECT * FROM base WHERE id = '.$id;
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_assoc($result); {
extract($row);
$output[] = '<tr>';
$output[] = '<td align="left" width="70"><input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /></td>';
$output[] = '<td align="left" width="70">'.$model.'</td>';
$output[] = '<td align="left" width="110">'.$boundary_minair.'</td>';
$output[] = '<td align="left" width="110">'.$boundary_maxair.'</td>';
$output[] = '<td align="left" width="242"><a href="slimtec-schedule.php?action=delete&id='.$id.'" class="r">Remove</a></td>';
}
}} else {
$output[] = '<p>Your project schedule is empty.</p>';
}
return join('',$output);
}
?>