ถามเรื่อง สั่งซื้อสินค้าครับ
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา ถามเรื่อง สั่งซื้อสินค้าครับ
ถามเรื่อง สั่งซื้อสินค้าครับ
พอเราอยุ่หน้าที่จะบันทึกสั่งซื้อสินค้าแล้ว เราต้องกดส่งค่าอะไรไปเพิ่มอีกไหมครับ ผมไม่เข้าใจเลย ผู้รู้ช่วยแนะนำด้วยครับ ขอบคุณครับ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | <?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> $( 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 ); ?> |

คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
ความคิดเห็นที่
1

แนวทางศึกษา ระบบตะกร้าสินค้า shopping cart อย่างง่าย
https://www.ninenik.com/content.php?arti_id=647 via @ninenik

ขอบคุณทุกการสนับสนุน
![]()