I'm pulling hair out of my bald head trying to figure out how to set up a form box within this fairly simple PHP script, (this script works fine), that allows a user to enter their email address, and when they hit the submit button it send them a list of the query results as well as me. The only item from the query results that can be omitted from the email would be the images. Any help would be very gratefully appreciated. Below is the script.
[PHP]<?
ob_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>phpCar t</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="phpCart_s tyle.css" rel="stylesheet " type="text/css">
</head>
<body>
<form name="update" method="post" action="phpCart _manage.php">
<table width="50%" border="0" cellspacing="0" cellpadding="5" >
<tr bgcolor="#EEEEE E">
<td width="10%" class="bottomli ne"> </td>
<td width="10%" class="bottomli ne"><strong>Qty </strong></td>
<td width="50%" class="bottomli ne"><strong>Pro duct</strong></td>
<td width="10%" class="bottomli ne"><strong>Pic url</strong></td>
<td width="10%" class="bottomli ne"><strong>Pri ce</strong></td>
<td width="10%" class="bottomli ne"><strong>Lin e Total </strong></td>
</tr>
<?
include "functions_cart .php";
$totalvalue = 0;
session_start() ;
// If no sessions has been started $_SESSION["cart"] equals null, thus showing the message no items.
if (!isset($_SESSI ON["cart"])) {
$_SESSION["cart"] = NULL;
}
if (validate() == TRUE && $_SESSION["cart"] != NULL) {
foreach ($_SESSION["cart"] as $key => $session_data) {
list($ses_id, $ses_quan) = $session_data;
// call database connect function
db_connect();
$sel_products = mysql_query("SE LECT * FROM $mysql_tablenam e WHERE id=".$ses_id."" );
$item = mysql_fetch_arr ay($sel_product s);
$totalvalue = $totalvalue + ($item["price"]*$ses_quan);
$subtotal = ($item["price"]*$ses_quan);
?>
<tr>
<td class="dividing border"><a href="<? echo "phpCart_manage .php?act=del&pi d=".$ses_id; ?>"><img src="img/icon_del.gif" width="13" height="13" border="0"></a></td>
<td class="dividing border"><input name="newquan[]" type="text" id="newquan[]4" value="<? echo $ses_quan; ?>" size="5" maxlength="4">
<input name="eid[]" type="hidden" id="eid[]" value="<? echo $ses_id; ?>"></td>
<td class="dividing border"><? echo $item["product"]; ?></td>
<td class="dividing border"><? echo '<img src="'.$item["picurl"].'" width="100" height="100" alt="' . $item["product"] . ' Image"'; ?></td>
<td class="dividing border"><? echo $cur_symbol."". number_format($ item["price"], 2, '.', ''); ?></td>
<td class="dividing border"><? echo $cur_symbol."". number_format($ subtotal, 2, '.', ''); ?></td>
</tr>
<?
} // end foreach loop
} elseif ($_SESSION["cart"] == NULL) {
echo "<td colspan=\"5\">< center><p>Your basket is currently empty.</p></center></td>";
} else {
echo "<td colspan=\"5\">< center><p>Unkno wn Error.</p></center></td>";
}
?>
<tr>
<td> <img src="img/icon_del.gif" width="13" height="13"> - delete</td>
<td><? if ($_SESSION["cart"] != NULL) { echo "<input name=\"UpdateCh g\" type=\"submit\" id=\"UpdateChg\ " value=\"Update\ ">"; } ?></td>
<td><a href="phpCart_s hop.php">Contin ue Shopping</a></td>
<td><strong>Car t Total</strong></td>
<td><? echo $cur_symbol."". number_format($ totalvalue, 2, '.', ''); ?></td>
</tr>
</table>
</form>
</body>
</html>
<?
ob_end_flush();
?>[/PHP]
[PHP]<?
ob_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>phpCar t</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="phpCart_s tyle.css" rel="stylesheet " type="text/css">
</head>
<body>
<form name="update" method="post" action="phpCart _manage.php">
<table width="50%" border="0" cellspacing="0" cellpadding="5" >
<tr bgcolor="#EEEEE E">
<td width="10%" class="bottomli ne"> </td>
<td width="10%" class="bottomli ne"><strong>Qty </strong></td>
<td width="50%" class="bottomli ne"><strong>Pro duct</strong></td>
<td width="10%" class="bottomli ne"><strong>Pic url</strong></td>
<td width="10%" class="bottomli ne"><strong>Pri ce</strong></td>
<td width="10%" class="bottomli ne"><strong>Lin e Total </strong></td>
</tr>
<?
include "functions_cart .php";
$totalvalue = 0;
session_start() ;
// If no sessions has been started $_SESSION["cart"] equals null, thus showing the message no items.
if (!isset($_SESSI ON["cart"])) {
$_SESSION["cart"] = NULL;
}
if (validate() == TRUE && $_SESSION["cart"] != NULL) {
foreach ($_SESSION["cart"] as $key => $session_data) {
list($ses_id, $ses_quan) = $session_data;
// call database connect function
db_connect();
$sel_products = mysql_query("SE LECT * FROM $mysql_tablenam e WHERE id=".$ses_id."" );
$item = mysql_fetch_arr ay($sel_product s);
$totalvalue = $totalvalue + ($item["price"]*$ses_quan);
$subtotal = ($item["price"]*$ses_quan);
?>
<tr>
<td class="dividing border"><a href="<? echo "phpCart_manage .php?act=del&pi d=".$ses_id; ?>"><img src="img/icon_del.gif" width="13" height="13" border="0"></a></td>
<td class="dividing border"><input name="newquan[]" type="text" id="newquan[]4" value="<? echo $ses_quan; ?>" size="5" maxlength="4">
<input name="eid[]" type="hidden" id="eid[]" value="<? echo $ses_id; ?>"></td>
<td class="dividing border"><? echo $item["product"]; ?></td>
<td class="dividing border"><? echo '<img src="'.$item["picurl"].'" width="100" height="100" alt="' . $item["product"] . ' Image"'; ?></td>
<td class="dividing border"><? echo $cur_symbol."". number_format($ item["price"], 2, '.', ''); ?></td>
<td class="dividing border"><? echo $cur_symbol."". number_format($ subtotal, 2, '.', ''); ?></td>
</tr>
<?
} // end foreach loop
} elseif ($_SESSION["cart"] == NULL) {
echo "<td colspan=\"5\">< center><p>Your basket is currently empty.</p></center></td>";
} else {
echo "<td colspan=\"5\">< center><p>Unkno wn Error.</p></center></td>";
}
?>
<tr>
<td> <img src="img/icon_del.gif" width="13" height="13"> - delete</td>
<td><? if ($_SESSION["cart"] != NULL) { echo "<input name=\"UpdateCh g\" type=\"submit\" id=\"UpdateChg\ " value=\"Update\ ">"; } ?></td>
<td><a href="phpCart_s hop.php">Contin ue Shopping</a></td>
<td><strong>Car t Total</strong></td>
<td><? echo $cur_symbol."". number_format($ totalvalue, 2, '.', ''); ?></td>
</tr>
</table>
</form>
</body>
</html>
<?
ob_end_flush();
?>[/PHP]
Comment