本文介绍了我如何乘以价格和金额?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将价格乘以金额并在显示的代码中显示如下:
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 [' 颜色跨度>]);
$ Amount = trim($ _ POST [' 金额跨度>]);
$ Price = trim($ _ POST [' 价格'跨度>]);
$ headers = 来自Awesome先生;
$ headers2 = 表单副本提交跨度>;
$ query = INSERT INTO`quartformdata`(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>订单< / title>
< link href =css / style.cssmedia =screen =stylesheettype =text / css/>
< link rel =stylesheethref =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 =stylesheethref =buttons.css>
< / head>
< body>
$ _SESSION ['link'] = $ _POST ['link'];
echo'< img src ='。$ _ SESSION ['link']。'>';
?>
订单
< form action =method =postid =register-表格novalidate =novalidate>
ProductID:< input type =textname =ProductIDid =ProductID>
颜色:< input type =textname =Colorid =Color>
金额:< input type =numbername =Amountid =Amount>
价格:echo''。$ _ SESSION ['price']。'';
?>
< input type =submitname =submitvalue =Submitclass =button>
< / form>
< script>
//当浏览器准备就绪时...
$(function(){
//#register-form element $ b上的设置表单验证$ b $(#register-form)。validate({
//指定验证规则
规则:{
颜色: {
required:
},
金额:{
required:true,
integer:true,
},
},
产品ID:必需,
},
//指定验证错误消息
消息:{
颜色:请输入有效颜色,
产品ID:请输入ID,
金额:请输入有效金额,
},
submitHandler:function(form){
form.submit();
}
});
});
< / script>
< / body>
< / html>
请帮助我:))
解决方案
How to multiply the price with the amount and show it below in the code shown:
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 :)
解决方案
这篇关于我如何乘以价格和金额?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!