Help WIth Order Form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Help WIth Order Form

Post 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>");
} 

?>
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post 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
}
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Post 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.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Where are these values coming from?

Code: Select all

$totalqty = $NNSQTY+$CBFNQTY+$AKNQTY+$CFNQTY+$CVNQTY ;
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Post 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.
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Post by darkfreaks »

how would i make it get the total amount of items ordered plus the total price? and put it in the mail?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Why are there four active threads on this one problem?
User avatar
andym01480
Forum Contributor
Posts: 390
Joined: Wed Apr 19, 2006 5:01 pm

Post 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)
Post Reply