Let me start off by saying this is a pretty straight foward question and if done well will be raised to 125 points. I wont be stingy dont worry.
Ok heres the question....
I created a simple script where people can email me an order they have instead of buying it. If you check out
http://cncg.com/sgreenstein/expanding.php you will see what im saying(only the first two expandable options work) Then scroll down and click submit.
You can try it out its still a work in progress. I would like to be able to have all the information that people type in emailed to me. Can someone please help me do this. Here is what I have so far.
I only want the stuff emailed to me if the someone ordered one of those items.
I guess theoretically this is how I would do it. have an if statment and if the quantity variable and the number is greater than 0 meaning someone filled out the qty field on the previous page then that should become a different variable and be mailed to me. I dont need the price all I need to know is what they ordered and how much of it. Is this possible and if yes please let me know I would like to get this done. If you consider this hard please let me know and I will consider bumping up the question even more.
<html>
<head>
<title>Welcome To CNCG.com</title>
<meta http-equiv="Content-Type" content="text/html;charset
=utf-8">
<link rel="stylesheet" type="text/css" href="master1.css">
<script language="JavaScript1.3" type="text/javascript" src="jse_form.js"></script
>
<script language="JavaScript1.3" type="text/javascript" src="jse_search.js"></scri
pt>
</head>
<body>
<table width="740" cellspacing="1" cellpadding="0" border="0" bgcolor="#000000">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?php include("header.htm"); ?></td>
</tr>
<tr>
<td bgcolor="white" align="right">
<?php include ("hornav.htm");?>
</td>
</tr>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff" height="600" width="100%" valign="top">
<tr>
<td width="160" valign="top"><?php include("leftnav.php"); ?></td>
<td width="500" valign="top">
<?php
//create short variable names
$item1 = $HTTP_POST_VARS['quantity1
'];
$item2 = $HTTP_POST_VARS['quantity2
'];
$item3 = $HTTP_POST_VARS['quantity3
'];
$item4 = $HTTP_POST_VARS['quantity4
'];
$item5 = $HTTP_POST_VARS['quantity5
'];
$item6 = $HTTP_POST_VARS['quantity6
'];
$item7 = $HTTP_POST_VARS['quantity7
'];
$item8 = $HTTP_POST_VARS['quantity8
'];
$item9 = $HTTP_POST_VARS['quantity9
'];
$item10 = $HTTP_POST_VARS['quantity1
0'];
$item11 = $HTTP_POST_VARS['quantity1
1'];
$item12 = $HTTP_POST_VARS['quantity1
2'];
$item13 = $HTTP_POST_VARS['quantity1
3'];
$item14 = $HTTP_POST_VARS['quantity1
4'];
$item15 = $HTTP_POST_VARS['quantity1
5'];
$item16 = $HTTP_POST_VARS['quantity1
6'];
$item17 = $HTTP_POST_VARS['quantity1
7'];
$item18 = $HTTP_POST_VARS['quantity1
8'];
$item19 = $HTTP_POST_VARS['quantity1
9'];
$item20 = $HTTP_POST_VARS['quantity2
0'];
$item21 = $HTTP_POST_VARS['quantity2
1'];
$item22 = $HTTP_POST_VARS['quantity2
2'];
$item23 = $HTTP_POST_VARS['quantity2
3'];
$item24 = $HTTP_POST_VARS['quantity2
4'];
$item25 = $HTTP_POST_VARS['quantity2
5'];
$item26 = $HTTP_POST_VARS['quantity2
6'];
$item27 = $HTTP_POST_VARS['quantity2
7'];
$item28 = $HTTP_POST_VARS['quantity2
8'];
$item29 = $HTTP_POST_VARS['quantity2
9'];
$item30 = $HTTP_POST_VARS['quantity3
0'];
$item31 = $HTTP_POST_VARS['quantity3
1'];
$item31 = $HTTP_POST_VARS['quantity3
2'];
$item33 = $HTTP_POST_VARS['quantity3
3'];
$item34 = $HTTP_POST_VARS['quantity3
4'];
$item35 = $HTTP_POST_VARS['quantity3
5'];
$item36 = $HTTP_POST_VARS['quantity3
6'];
$item37 = $HTTP_POST_VARS['quantity3
7'];
$item38 = $HTTP_POST_VARS['quantity3
8'];
$item39 = $HTTP_POST_VARS['quantity3
9'];
$item40 = $HTTP_POST_VARS['quantity4
0'];
$item41 = $HTTP_POST_VARS['quantity4
1'];
$item42 = $HTTP_POST_VARS['quantity4
2'];
$item43 = $HTTP_POST_VARS['quantity4
3'];
$item44 = $HTTP_POST_VARS['quantity4
4'];
$item45 = $HTTP_POST_VARS['quantity4
5'];
$item46 = $HTTP_POST_VARS['quantity4
6'];
$item47 = $HTTP_POST_VARS['quantity4
7'];
$item48 = $HTTP_POST_VARS['quantity4
8'];
$item49 = $HTTP_POST_VARS['quantity4
9'];
$item50 = $HTTP_POST_VARS['quantity5
0'];
$item51 = $HTTP_POST_VARS['quantity5
1'];
$item52 = $HTTP_POST_VARS['quantity5
2'];
$item53 = $HTTP_POST_VARS['quantity5
3'];
$item54 = $HTTP_POST_VARS['quantity5
4'];
$item55 = $HTTP_POST_VARS['quantity5
5'];
$item56 = $HTTP_POST_VARS['quantity5
6'];
$item57 = $HTTP_POST_VARS['quantity5
7'];
$item58 = $HTTP_POST_VARS['quantity5
8'];
$item59 = $HTTP_POST_VARS['quantity5
9'];
$item60 = $HTTP_POST_VARS['quantity6
0'];
$item61 = $HTTP_POST_VARS['quantity6
1'];
$item62 = $HTTP_POST_VARS['quantity6
2'];
$item63 = $HTTP_POST_VARS['quantity6
3'];
$item64 = $HTTP_POST_VARS['quantity6
4'];
$item27price = $HTTP_POST_VARS['dealercos
t27'];
$item28price = $HTTP_POST_VARS['dealercos
t28'];
$item29price = $HTTP_POST_VARS['dealercos
t29'];
$item30price = $HTTP_POST_VARS['dealercos
t30'];
$item31price = $HTTP_POST_VARS['dealercos
t31'];
$item32price = $HTTP_POST_VARS['dealercos
t32'];
$item33price = $HTTP_POST_VARS['dealercos
t33'];
$item34price = $HTTP_POST_VARS['dealercos
t34'];
$item35price = $HTTP_POST_VARS['dealercos
t35'];
$item36price = $HTTP_POST_VARS['dealercos
t36'];
$item37price = $HTTP_POST_VARS['dealercos
t37'];
$item38price = $HTTP_POST_VARS['dealercos
t38'];
$item39price = $HTTP_POST_VARS['dealercos
t39'];
$item40price = $HTTP_POST_VARS['dealercos
t40'];
$item41price = $HTTP_POST_VARS['dealercos
t41'];
$item42price = $HTTP_POST_VARS['dealercos
t42'];
$item43price = $HTTP_POST_VARS['dealercos
t43'];
$item44price = $HTTP_POST_VARS['dealercos
t44'];
$item45price = $HTTP_POST_VARS['dealercos
t45'];
$item46price = $HTTP_POST_VARS['dealercos
t46'];
$item47price = $HTTP_POST_VARS['dealercos
t47'];
$item48price = $HTTP_POST_VARS['dealercos
t48'];
$item49price = $HTTP_POST_VARS['dealercos
t49'];
$item50price = $HTTP_POST_VARS['dealercos
t50'];
$item51price = $HTTP_POST_VARS['dealercos
t51'];
$item52price = $HTTP_POST_VARS['dealercos
t52'];
$item53price = $HTTP_POST_VARS['dealercos
t53'];
$item54price = $HTTP_POST_VARS['dealercos
t54'];
$item55price = $HTTP_POST_VARS['dealercos
t55'];
$item56price = $HTTP_POST_VARS['dealercos
t56'];
$item57price = $HTTP_POST_VARS['dealercos
t57'];
$item58price = $HTTP_POST_VARS['dealercos
t58'];
$item59price = $HTTP_POST_VARS['dealercos
t59'];
$item60price = $HTTP_POST_VARS['dealercos
t60'];
$item61price = $HTTP_POST_VARS['dealercos
t61'];
$item61price = $HTTP_POST_VARS['dealercos
t62'];
$item63price = $HTTP_POST_VARS['dealercos
t63'];
$item64price = $HTTP_POST_VARS['dealercos
t64'];
$title = $HTTP_POST_VARS['title'];
$first_name = $HTTP_POST_VARS['first_nam
e'];
$last_name = $HTTP_POST_VARS['last_name
'];
$organziation = $HTTP_POST_VARS['organizat
ion'];
$address = $HTTP_POST_VARS['address']
;
$city = $HTTP_POST_VARS['city'];
$state = $HTTP_POST_VARS['state'];
$zipcode = $HTTP_POST_VARS['zipcode']
;
$phone = $HTTP_POST_VARS['phone'];
$fax = $HTTP_POST_VARS['fax'];
$email = $HTTP_POST_VARS['email'];
$DOCUMENT_ROOT = $HTTP_SERVER_VARS['DOCUMEN
T_ROOT'];
?>
<html>
<head>
<title>CNCG - Order Results</title>
</head>
<body>
<h1>CNCG - Order Results</h1>
<h2>Order Results</h2>
<?php
$totalqty = 0;
$totalqty += $item1;
$totalqty += $item2;
$totalqty += $item3;
$totalqty += $item4;
$totalqty += $item5;
$totalqty += $item6;
$totalqty += $item7;
$totalqty += $item8;
$totalqty += $item9;
$totalqty += $item10;
$totalqty += $item11;
$totalqty += $item12;
$totalqty += $item13;
$totalqty += $item14;
$totalqty += $item15;
$totalqty += $item16;
$totalqty += $item17;
$totalqty += $item18;
$totalqty += $item19;
$totalqty += $item20;
$totalqty += $item21;
$totalqty += $item22;
$totalqty += $item23;
$totalqty += $item24;
$totalqty += $item25;
$totalqty += $item26;
$totalqty += $item27;
$totalqty += $item28;
$totalqty += $item29;
$totalqty += $item30;
$totalqty += $item31;
$totalqty += $item32;
$totalqty += $item33;
$totalqty += $item34;
$totalqty += $item35;
$totalqty += $item36;
$totalqty += $item37;
$totalqty += $item38;
$totalqty += $item39;
$totalqty += $item40;
$totalqty += $item41;
$totalqty += $item42;
$totalqty += $item43;
$totalqty += $item44;
$totalqty += $item45;
$totalqty += $item46;
$totalqty += $item47;
$totalqty += $item48;
$totalqty += $item49;
$totalqty += $item50;
$totalqty += $item51;
$totalqty += $item52;
$totalqty += $item53;
$totalqty += $item54;
$totalqty += $item55;
$totalqty += $item56;
$totalqty += $item57;
$totalqty += $item58;
$totalqty += $item60;
$totalqty += $item61;
$totalqty += $item62;
$totalqty += $item63;
$totalqty += $item64;
//This is where the total amount is defined. And set the price for each item
$totalamount = 0.00;
define('item1', 205.00);
define('item2', 0);
define('item3', 125.00);
define('item4', 310.00);
define('item5', 85.00);
define('item6', 75.00);
define('item7', 105.00);
define('item8', 105.00);
define('item9', 310.00);
define('item10', 310.00);
define('item11', 95.00);
define('item12', 410.00);
define('item13', 205.00);
define('item14', 125.00);
define('item15', 185.00);
define('item16', 310.00);
define('item17', 310.00);
define('item18', 85.00);
define('item19', 180.00);
define('item20', 510.00);
define('item21', 410.00);
define('item22', 205.00);
define('item23', 330.00);
define('item24', 360.00);
define('item25', 15.00);
define('item26', 30.00);
define('item27', "$item27price");
define('item28', "$item28price");
define('item29', "$item29price");
define('item30', "$item30price");
define('item31', "$item31price");
define('item32', "$item32price");
define('item33', "$item33price");
define('item34', "$item34price");
define('item35', "$item35price");
define('item36', "$item36price");
define('item37', "$item37price");
define('item38', "$item38price");
define('item39', "$item39price");
define('item40', "$item40price");
define('item41', "$item41price");
define('item42', "$item42price");
define('item43', "$item43price");
define('item44', "$item44price");
define('item45', "$item45price");
define('item46', "$item46price");
define('item47', "$item47price");
define('item48', "$item48price");
define('item49', "$item49price");
define('item50', "$item50price");
define('item51', "$item51price");
define('item52', "$item52price");
define('item53', "$item53price");
define('item54', "$item54price");
define('item55', "$item55price");
define('item56', "$item56price");
define('item57', "$item57price");
define('item58', "$item58price");
define('item59', "$item59price");
define('item60', "$item60price");
define('item61', "$item61price");
define('item62', "$item62price");
define('item63', "$item63price");
define('item64', "$item64price");
$date = date('H:i, jS F');
echo '<p>Order processed at ';
echo $date;
echo '<br />';
echo '<p>Your order is as follows:';
echo '<br />';
echo '<br />';
echo "<b>";
if( $totalqty == 0 )
{
echo 'You did not order anything on the previous page!<br />';
}
else
{
if ( $quantity1>0 )
echo $quantity1.' V300s<br />';
if ( $quantity2>0 )
echo $quantity2.' V66s<br />';
if ( $quantity3>0 )
echo $quantity3.' V66 Easyspeaks<br />';
if ( $quantity4>0 )
echo $quantity4.' V600<br />';
if ( $quantity5>0 )
echo $quantity5.' 3390 EasySpeak<br />';
if ( $quantity6>0 )
echo $quantity6.' 3390 Easy speak without activation coupon<br />';
if ( $quantity7>0 )
echo $quantity7.' Nokia 3595<br />';
if ( $quantity8>0 )
echo $quantity8.' Nokia 3595 EasySpeak<br />';
if ( $quantity9>0 )
echo $quantity9.' Nokia 3650<br />';
if ( $quantity10>0 )
echo $quantity10.' Nokia 3660<br />';
if ( $quantity11>0 )
echo $quantity11.' Nokia 6010<br />';
if ( $quantity12>0 )
echo $quantity12.' Nokia 6600<br />';
if ( $quantity13>0 )
echo $quantity13.' Nokia 6800<br />';
if ( $quantity14>0 )
echo $quantity14.' Siemens CF62T<br />';
if ( $quantity15>0 )
echo $quantity15.' Sony Ericsson T610<br />';
if ( $quantity16>0 )
echo $quantity16.' Samsung D415<br />';
if ( $quantity17>0 )
echo $quantity17.' Samsung E715<br />';
if ( $quantity18>0 )
echo $quantity18.' Samsung R225<br />';
if ( $quantity19>0 )
echo $quantity19.' Samsung E105<br />';
if ( $quantity20>0 )
echo $quantity20.' Treo 600<br />';
if ( $quantity21>0 )
echo $quantity21.' Pocket PC<br />';
if ( $quantity22>0 )
echo $quantity22.' Color Sidekick<br />';
if ( $quantity23>0 )
echo $quantity23.' Sierra Data Card<br />';
if ( $quantity24>0 )
echo $quantity24.' Blackberry 7230 Color<br />';
if ( $quantity25>0 )
echo $quantity25.' Sim Card<br />';
if ( $quantity26>0 )
echo $quantity26.' Sim / Pin Combo<br />';
if ( $quantity27>0 )
echo $quantity27.' Innostream 89<br />';
if ( $quantity28>0 )
echo $quantity28.' Innostream 90<br />';
if ( $quantity29>0 )
echo $quantity29.' spark plugs<br />';
if ( $quantity30>0 )
echo $quantity30.' spark plugs<br />';
if ( $quantity31>0 )
echo $quantity31.' spark plugs<br />';
if ( $quantity32>0 )
echo $quantity32.' spark plugs<br />';
if ( $quantity33>0 )
echo $quantity33.' spark plugs<br />';
if ( $quantity34>0 )
echo $quantity34.' spark plugs<br />';
if ( $quantity35>0 )
echo $quantity35.' spark plugs<br />';
if ( $quantity36>0 )
echo $quantity36.' spark plugs<br />';
if ( $quantity37>0 )
echo $quantity37.' spark plugs<br />';
if ( $quantity38>0 )
echo $quantity38.' spark plugs<br />';
if ( $quantity39>0 )
echo $quantity39.' spark plugs<br />';
if ( $quantity40>0 )
echo $quantity40.' spark plugs<br />';
if ( $quantity41>0 )
echo $quantity41.' spark plugs<br />';
if ( $quantity42>0 )
echo $quantity42.' spark plugs<br />';
if ( $quantity43>0 )
echo $quantity43.' spark plugs<br />';
if ( $quantity44>0 )
echo $quantity44.' spark plugs<br />';
if ( $quantity45>0 )
echo $quantity45.' spark plugs<br />';
if ( $quantity46>0 )
echo $quantity46.' spark plugs<br />';
if ( $quantity47>0 )
echo $quantity47.' spark plugs<br />';
if ( $quantity48>0 )
echo $quantity48.' spark plugs<br />';
if ( $quantity49>0 )
echo $quantity49.' spark plugs<br />';
if ( $quantity50>0 )
echo $quantity50.' spark plugs<br />';
if ( $quantity51>0 )
echo $quantity51.' spark plugs<br />';
if ( $quantity52>0 )
echo $quantity52.' spark plugs<br />';
if ( $quantity53>0 )
echo $quantity53.' spark plugs<br />';
if ( $quantity54>0 )
echo $quantity54.' spark plugs<br />';
if ( $quantity55>0 )
echo $quantity55.' spark plugs<br />';
if ( $quantity56>0 )
echo $quantity56.' spark plugs<br />';
if ( $quantity57>0 )
echo $quantity57.' spark plugs<br />';
if ( $quantity58>0 )
echo $quantity58.' spark plugs<br />';
if ( $quantity59>0 )
echo $quantity59.' spark plugs<br />';
if ( $quantity60>0 )
echo $quantity60.' spark plugs<br />';
if ( $quantity61>0 )
echo $quantity61.' spark plugs<br />';
if ( $quantity62>0 )
echo $quantity62.' spark plugs<br />';
if ( $quantity63>0 )
echo $quantity63.' spark plugs<br />';
if ( $quantity64>0 )
echo $quantity64.' spark plugs<br />';
}
echo "</b>";
$total =
$item1 * item1 +
$item2 * item2 +
$item3 * item3 +
$item4 * item4 +
$item5 * item5 +
$item6 * item6 +
$item7 * item7 +
$item8 * item8 +
$item9 * item9 +
$item10 * item10 +
$item11 * item11 +
$item12 * item12 +
$item13 * item13 +
$item14 * item14 +
$item15 * item15 +
$item16 * item16 +
$item17 * item17 +
$item18 * item18 +
$item19 * item19 +
$item20 * item20 +
$item21 * item21 +
$item22 * item22 +
$item23 * item23 +
$item24 * item24 +
$item25 * item25 +
$item26 * item26 +
$item27 * item27 +
$item28 * item28 +
$item29 * item29 +
$item30 * item30 +
$item31 * item31 +
$item32 * item32 +
$item33 * item33 +
$item34 * item34 +
$item35 * item35 +
$item36 * item36 +
$item37 * item37 +
$item38 * item38 +
$item39 * item39 +
$item40 * item40 +
$item41 * item41 +
$item42 * item42 +
$item43 * item43 +
$item44 * item44 +
$item45 * item45 +
$item46 * item46 +
$item47 * item47 +
$item48 * item48 +
$item49 * item49 +
$item50 * item50 +
$item51 * item51 +
$item52 * item52 +
$item53 * item53 +
$item54 * item54 +
$item55 * item55 +
$item56 * item56 +
$item57 * item57 +
$item58 * item58 +
$item59 * item59 +
$item60 * item60 +
$item61 * item61 +
$item62 * item62 +
$item63 * item63 +
$item64 * item64 +
$total=number_format($tota
l, 2, '.', ' ');
echo '<P>Total of order is $'.$total.'</p>';
echo '<P>Address to ship to is '.$address.'<br />';
echo "$title"; echo " $first_name";
$outputstring = $date."\t".$tireqty." tires \t".$oilqty." oil\t"
.$sparkqty." spark plugs\t\$".$total
."\t". $address."\n";
/*
// open file for appending
$fp = fopen("$DOCUMENT_ROOT/orde
rs.txt", 'a');
flock($fp, LOCK_EX);
if (!$fp)
{
echo '<p><strong> Your order could not be processed at this time. '
.'Please try again later.</strong></p></body>
</html>';
exit;
}
fwrite($fp, $outputstring);
flock($fp, LOCK_UN);
fclose($fp);
echo '<p>Order written.</p>';
*/
//start building the mail string
$msg = "Name: ".$outputstring." \n";
//set up the mail
$recipient = "my email address";
$subject = "Form Submission Results";
// Add this if ytou want to make the email html $mailheaders .= "Content-type: text/html \n";
//send the mail
mail($recipient, $subject, $msg, $mailheaders);
?>
</td>
<td width="90" valign="top" align="right"><?php include("right_ads.htm"); ?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#ffffff"><?php include("footer.htm"); ?></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Start Free Trial