Page 1 of 1

Help WIth Order Form

Posted: Tue Nov 28, 2006 2:30 pm
by darkfreaks
ok i fixed up some minor errors.

so the form mails but it doesnt do anything really what i need it to do is send the total price amount plsu the total quantity amount and how much purchased of each item to the email adress of that person who is making the orders. then if submittied i want it to echo thank you for shopping at lilyshop your order has been processed! and like a subtotal for each item

Code: Select all

<?php

if ($_POST) { 
if (ctype_alpha($_POST['email'])) { $email = $_POST['email']; }
else $mailerror = "You must enter a valid email!<br />"; }
if (ctype_alpha($_POST['name'])) { $name = $_POST['name']; }
else $nerror = "You must enter a valid email!<br />"; 
if (ctype_alpha($_POST['qty'])) { $qty = $_POST['qty']; }
if (ctype_alpha($_POST['submit'])) { $submit = $_POST['submit']; }

define("NECKLACEOFTHENIGHTSKY", 50);
define("CHAINAILEFANCYBEADEDNECKLACE", 50);
define("ANTIQUEKEYNECKLACE", 30);
define("CHAINMAILEFANCYNECKLACE", 50);
define("CHAINMAILEVNECKLACE", 50);


$totalqty = 0;
$totalamount =  $:0.00;

$totalqty = $NNSQTY+$CBFNQTY+$AKNQTY+$CFNQTY+$CVNQTY ;

$totalamount = $NNSQTY * NECKLACEOFTHENIGHTSKY
               +$CBFNQTY * CHAINAILEFANCYBEADEDNECKLACE
			   +$AKNQTY * ANTIQUEKEYNECKLACE
               +$CFNQTY *CHAINMAILEFANCYNECKLACE
               +$CVNQTY* CHAINMAILEVNECKLACE;
mail('mowtripleh@example.com',"From: $name <$email>","Total Amount:$totalamount","Quantity Ordered:$qty");

if (mail('mowtripleh@example.com',"From: $name <$email>","Total Amount:$totalamount","Quantity Ordered:$qty"))
{ echo ("<p>Thank you for shopping at Lillys Shop! Your OrderHas Been Sent!</p>");
} 

?>

Posted: Tue Nov 28, 2006 2:54 pm
by hawleyjr
Looks like you are sending 2 emails. (Do either of them work?)

Code: Select all

mail('mowtripleh@example.com',"From: $name <$email>","Total Amount:$totalamount","Quantity Ordered:$qty");

if (mail('mowtripleh@example.com',"From: $name <$email>","Total Amount:$totalamount","Quantity Ordered:$qty"))
{ 
          echo ("<p>Thank you for shopping at Lillys Shop! Your OrderHas Been Sent!</p>");
}
Try it like this:

Code: Select all

if (mail('mowtripleh@example.com',"From: $name <$email>","Total Amount:$totalamount","Quantity Ordered:$qty"))
{ 
          echo ("<p>Thank you for shopping at Lillys Shop! Your OrderHas Been Sent!</p>");
}else{
           echo 'Email did not send';//notify admin...blah blah blah
}

Posted: Tue Nov 28, 2006 3:00 pm
by darkfreaks
the mail functions work however it doesnt give you a total quantity or price amount. its an empty email basicly.


ps- it was sending 2 emails thanks for picking up on that its now fixed.

Posted: Tue Nov 28, 2006 3:12 pm
by hawleyjr
Where are these values coming from?

Code: Select all

$totalqty = $NNSQTY+$CBFNQTY+$AKNQTY+$CFNQTY+$CVNQTY ;

Posted: Tue Nov 28, 2006 3:19 pm
by darkfreaks
well its sposed to grab the quantity of each item the same for totquantity box each named different like then post the total quantity in the email.

Posted: Tue Nov 28, 2006 3:41 pm
by darkfreaks
how would i make it get the total amount of items ordered plus the total price? and put it in the mail?

Posted: Tue Nov 28, 2006 4:34 pm
by feyd
Why are there four active threads on this one problem?

Posted: Tue Nov 28, 2006 4:51 pm
by andym01480
On the email side of the script check out mail function help
The mail function should look like...
mail(to,subject,message,headers)