Forum Moderators: coopster

Message Too Old, No Replies

More complex form to process (to me anyway)

         

pixeldiver

6:12 am on Nov 19, 2009 (gmt 0)

10+ Year Member



Hi all,
I have a site where users can select different items and these items are then sent to a schedule on another page.

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">&nbsp;</td>
</tr>
<tr>
<td colspan="7" align="center">&nbsp;</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">&nbsp;</td>
<td width="183" align="center">&nbsp;</td>
<td width="227" align="center">&nbsp;</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);
}
?>

dreamcatcher

7:11 pm on Dec 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi pixeldiver,

Are you seeing errors? Lets start with some error reporting. At the top of your script use:

error_reporting(E_ALL);

See if that displays any issues. You don`t actually display any of your mail code, so that doesn`t help. Maybe the issue is with how you have your code?

dc

TheMadScientist

12:04 am on Dec 31, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In addition to the above, you might also let us know what does happen? (In this case, nothing is something, so maybe give us an idea of what's actually going on other than not working as expected...)