ถามเรื่อง สั่งซื้อสินค้าครับ
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา ถามเรื่อง สั่งซื้อสินค้าครับ
ถามเรื่อง สั่งซื้อสินค้าครับ
Copy
พอเราอยุ่หน้าที่จะบันทึกสั่งซื้อสินค้าแล้ว เราต้องกดส่งค่าอะไรไปเพิ่มอีกไหมครับ ผมไม่เข้าใจเลย ผู้รู้ช่วยแนะนำด้วยครับ ขอบคุณครับ
<?php require_once('Connections/myconnect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_myconnect, $myconnect);
$query_Recordset1 = "SELECT * FROM customer";
$Recordset1 = mysql_query($query_Recordset1, $myconnect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
error_reporting( error_reporting() & ~E_NOTICE );
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Shopping Cart</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<?php include("manu.php");?>
<div class="container">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<p> </p>
<table width="700" border="1" align="center" class="table">
<tr>
<td width="1558" colspan="5" align="center">
<strong>สั่งซื้อสินค้า</strong></td>
</tr>
<tr class="success">
<td align="center">ลำดับ</td>
<td align="center">สินค้า</td>
<td align="center">ราคา</td>
<td align="center">จำนวน</td>
<td align="center">รวม/รายการ</td>
</tr>
<?php
require_once('Connections/myconnect.php');
$total=0;
foreach(@$_SESSION['shopping_cart'] as $id=>$p_qty)
{
$sql = "SELECT * FROM product WHERE id=$id";
$query = mysql_db_query($database_myconnect, $sql);
$row = mysql_fetch_array($query);
$sum = $row['prd_price']*$p_qty;
$total += $sum;
echo "<tr>";
echo "<td align='center'>";
echo $i += 1;
echo "</td>";
echo "<td>" . $row["prd_name"] . "</td>";
echo "<td align='right'>" .number_format($row['prd_price'],2) ."</td>";
echo "<td align='right'>$p_qty</td>";
echo "<td align='right'>".number_format($sum,2)."</td>";
echo "</tr>";
}
echo "<tr>";
echo "<td align='right' colspan='4'><b>รวม</b></td>";
echo "<td align='right'>"."<b>".number_format($total,2)."</b>"."</td>";
echo "</tr>";
?>
</table>
<table width="325" border="1" align="center">
<tr>
<td>ชื่อลูกค้า</td>
<td><?php echo $row_Recordset1['c_name']; ?></td>
</tr>
<tr>
<td>วันที่สั่งทำ</td>
<td>
<?
@$date = date(" j / n / Y") ;
echo $date ;
?>
</td>
</tr>
<tr>
<td>วันที่กำหนดส่ง</td>
<td>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#datepicker" ).datepicker();
} );
</script>
<p> <input type="text" id="datepicker"></p></td>
</tr>
<tr>
<td>ค่ามัดจำ</td>
<td><?php
$sum1 = $total*0.3;
echo number_format($sum1)."บาท";
?></td>
</tr>
<tr>
<td>จำนวนงวด</td>
<td><?php
$a = 2; $b=4;
if ($i = $total <= 150000 ){
echo $a." ";
}
else{
echo $b." ";
}
?>
</td>
</tr>
<tr>
<td>ราคารวม</td>
<?php echo "<td align='right'>"."<b>".number_format($total,2)."</b>"."</td>";?>
</tr>
</table>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-5" style="background-color:#f4f4f4">
<h3 align="center" style="color:green"><span class="glyphicon glyphicon-shopping-cart"> </span>
</h3>
<td colspan="8" style="text-align: right;">
<a href="saveorder.php?id=<?php echo $_SESSION['id']; ?>" type="submit" class="btn btn-primary btn-lg">บันทึกการสั่งซื้อสินค้า</a>
<a href="cart.php" type="button" class="btn btn-danger btn-lg">ย้อนกลับ</a>
</td>
</div>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา
โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ