How to multiply the price with the amount and show it below in the code shown:
require('connect.php');
session_start();
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>
$(function() {
$("#register-form").validate({
rules: {
Color: {
required: true,
},
Amount: {
required: true,
integer: true,
},
},
ProductID: "required",
},
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 :)