Web Analytics Made Easy -
StatCounter Cant send total variable to email - CodingForum

Announcement

Collapse
No announcement yet.

Cant send total variable to email

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cant send total variable to email

    Hi

    I've got a simple shopping cart at



    When you go to the checkout how do i send the "Total $" amount to my email when i submit the form.

    my form allready works. it sends me the name email etc - just won't send me the $totalCost variable. Heres is the PHP that the form goes to when submit is clicked.


    Thanks

    Ben
    PHP:

    <?php

    include ("db.php");

    __//create short variable names

    __$name=$HTTP_POST_VARS['name'];

    __$email=$HTTP_POST_VARS['email'];

    __$feedback=$HTTP_POST_VARS['feedback'];

    __$totalCost=$HTTP_POST_VARS['totalCost'];



    __$toaddress = '[email protected]';

    __$subject = 'Feedback from web site';

    __$mailcontent = 'Customer name: '.$name."\n"

    _________________.'Customer email: '.$email."\n"

    _________________."Customer comments: \n".$feedback."\n"

    ________________ ."Customer price: \n".$totalCost."\n";

    __$fromaddress = 'From: [email protected]';



    __mail($toaddress, $subject, $mailcontent, $fromaddress);

    ?>

    <html>

    <head>

    __<title>Bob's Auto Parts - Feedback Submitted</title>

    </head>

    <body>

    <h1>Feedback submitted</h1>

    <p>Your feedback has been sent.</p>

    </body>

    </html>

    ?>

  • #2
    where is the totalCost variable coming from ? is it a field in your form ? if so check it is being populated/spelt correctly/not duplicated etc

    though really you should be calculating your costs at the scripts runtime & not relying on the form input as someone can quite easily spoof that with their own idea of the right cost
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

    Comment

    Working...
    X