email order form not working right?
Posted: Thu Nov 30, 2006 2:50 pm
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
well i sort of want it to verify the email then add up the quantity fields then mail the total amount and price to admin@yoursite.com (example adress).
i want it to read $name has purchased $totalqty items totaling $totalqty in the message and for the subject "my order".
i want a from field to that displays the email field. so you know what email its from.
and after its submitted i want it to echo $name you have bought $totalqty totaling $totalamount , thanks for shopping here!"
the code so far isCode: Select all
<?php
$NNSQTY = $_POST['NNSQTY'];
$CBFNQTY = $_POST['$CBFNQTY'];
$AKNQTY = $_POST['$AKNQTY'];
$CFNQTY = $_POST['$CFNQTY'];
$CVNQTY = $_POST['$CVNQTY'];
$from = $_POST['name'];
$email = $_POST['email'];
define("NECKLACEOFTHENIGHTSKY", 50);
define("CHAINAILEFANCYBEADEDNECKLACE", 50);
define("ANTIQUEKEYNECKLACE", 30);
define("CHAINMAILEFANCYNECKLACE", 50);
define("CHAINMAILEVNECKLACE", 50);
$totalqty = $NNSQTY+$CBFNQTY+$AKNQTY+$CFNQTY+$CVNQTY ;
$totalamount = $NNSQTY * NECKLACEOFTHENIGHTSKY
+$CBFNQTY * CHAINAILEFANCYBEADEDNECKLACE
+$AKNQTY * ANTIQUEKEYNECKLACE
+$CFNQTY *CHAINMAILEFANCYNECKLACE
+$CVNQTY* CHAINMAILEVNECKLACE;
$totalqty = 0;
$totalamount= 0.00;
//mail
$to = "admin@tattoos-n-piercings.com ";
$subject = "SubjectMy Order";
$email = $_POST['email'];
$from = ($_POST['name']);
$msg = "Message from: $from Has Bought $totalqty Items totaling $totalamount .";
if(preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$/i", $_POST['email']))
{
echo 'Please enter a valid email address.';
} else {
$send= mail("$to", "$email", "$subject","$from","$msg");
}
if($send)
{
echo "Your order has been sent successfully! Lily Will Contact you shortly. You have bought $totalqty items totaling $totalamount";
} else {
echo "There was an error sending the order, please go back and try again.";
}
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]