Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How to multiply the price with the amount and show it below in the code shown:
PHP
require('connect.php');
  session_start();


    // If the values are posted, insert them into the database.
    if (isset($_POST['ProductID']) && isset($_POST['Color']) && isset($_POST['Price']) && isset($_POST['Amount'])){
        $ProductID = trim($_POST['ProductID']);
      $Color = trim($_POST['Color']);
      $Amount = trim($_POST['Amount']);
      $Price = trim($_POST['Price']);



    $headers = "From Mr Awesome";
      $headers2 = "Copy of your form submission";

        $query = "INSERT INTO `orderformdata` (ProductID, Color, Amount, Price) VALUES ('$ProductID', '$Color','$Amount','$Price')";
        $result = mysql_query($query);
        if($result){
            if(isset($_POST['submit'])){
            mail($Color, $Amount, $headers);
          }
        }
    }
?>

<!DOCTYPE html>
<head>
<title>Order</title>
<link href="css/style.css" media="screen" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/custom.css" />
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
<link rel="stylesheet" href="buttons.css">
</head>
<body>




            $_SESSION['link'] = $_POST['link'];

       echo '<img src="'.$_SESSION['link'] .'">';


      ?>





          Order

          <form action="" method="post" id="register-form" novalidate="novalidate">
           ProductID: <input type="text" name="ProductID" id="ProductID">
            Color: <input type="text" name="Color" id="Color">
            Amount: <input type="number" name="Amount" id="Amount">
            Price:             echo ''.$_SESSION['price'].'';



            ?>

            <input type="submit" name="submit" value="Submit" class="button">
        </form>




<script>

  // When the browser is ready...
  $(function() {

    // Setup form validation on the #register-form element
    $("#register-form").validate({

        // Specify the validation rules
        rules: {


            Color: {
                required: true,

            },

             Amount: {
                required: true,
                integer: true,

            },


            },
            ProductID: "required",

        },

        // Specify the validation error messages
        messages: {
            Color: "Please enter a valid color",
            ProductID: "Please enter a ID",
            Amount: "Please enter a valid Amount",

        },

        submitHandler: function(form) {
            form.submit();
        }
    });

  });

  </script>


</body>
</html>


Help me please :)
Posted
Updated 21-Jun-15 23:17pm
v3

1 solution

Ever think about finding a tuto and learn the language ?

About down vote:
So ?
The question is not worth answering, but my advice is worth down voting ?
Be brave and answer the question.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900