|
 |
|
ระบบตะกร้าสินค้า ที่ต้องการเพิ่มรายละเอียดอื่นๆ และมีการส่งค่า แบบหลายๆ ค่า รบกวนสอบถามหน่อยครับ |
|
 |
|
|
 |
 |
|
จากที่ผมศึกษา code จาก thaicreate เรื่องระบบตะกร้าสินค้า อยากทราบว่า หากผมต้องการเพิ่ม field select ตามรูปที่หนึ่ง แล้ว จะต้องเขียน code ยังไงครับ จะมีการส่งค่า ไปยัง ภาพที่ 2 ยังไงครับ รบกวนหน่อยนะครับ โปรเจคจบคร้าบบ บ


Product
<?
//session_start();
//session_destroy();
?><html>
<head>
<title>ThaiCreate.Com</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<?
mysql_connect("localhost","root","sol#254");
mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM product";
$objQuery = mysql_query($strSQL) or die(mysql_error());
?>
<table width="327" border="1">
<tr>
<td width="101">Picture</td>
<td width="101">ProductID</td>
<td width="82">ProductName</td>
<td width="79">Price</td>
<td width="79">ขนาด</td>
<td width="79">สี</td>
<td width="79">จำนวน</td>
<td width="37">Cart</td>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><img src="img/<?=$objResult["Picture"];?>"></td>
<td><?=$objResult["ProductID"];?></td>
<td><?=$objResult["ProductName"];?></td>
<td><?=$objResult["Price"];?></td>
<td><select><option value="1">21"</option><option value="2">22"</option></select></td>
<td><select><option value="1">ขาว</option><option value="2">ดำ</option></select></td>
<td><select><option value="1">1</option><option value="2">2</option></select></td>
<td><a href="order.php?ProductID=<?=$objResult["ProductID"];?>">Order</a></td>
</tr>
<?
}
?>
</table>
<br><br><a href="show.php">View Cart</a> | <a href="clear.php">Clear Cart</a>
<?
mysql_close();
?>
</body>
</html>
<?/* This code download from www.ThaiCreate.Com */ ?>
show
<?
session_start();
?>
<html>
<head>
<title>ThaiCreate.Com</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<?
mysql_connect("localhost","root","sol#254");
mysql_select_db("mydatabase");
?>
<table width="400" border="1">
<tr>
<td width="101">ProductID</td>
<td width="82">ProductName</td>
<td width="82">ขนาด</td>
<td width="82">สี</td>
<td width="82">Price</td>
<td width="79">Qty</td>
<td width="79">Total</td>
<td width="10">Del</td>
</tr>
<?
$Total = 0;
$SumTotal = 0;
for($i=0;$i<=(int)$_SESSION["intLine"];$i++)
{
if($_SESSION["strProductID"][$i] != "")
{
$strSQL = "SELECT * FROM product WHERE ProductID = '".$_SESSION["strProductID"][$i]."' ";
$objQuery = mysql_query($strSQL) or die(mysql_error());
$objResult = mysql_fetch_array($objQuery);
$Total = $_SESSION["strQty"][$i] * $objResult["Price"];
$SumTotal = $SumTotal + $Total;
?>
<tr>
<td><?=$_SESSION["strProductID"][$i];?></td>
<td><?=$objResult["ProductName"];?></td>
<td></td>
<td></td>
<td><?=$objResult["Price"];?></td>
<td><?=$_SESSION["strQty"][$i];?></td>
<td><?=number_format($Total,2);?></td>
<td><a href="delete.php?Line=<?=$i;?>">x</a></td>
</tr>
<?
}
}
?>
</table>
Sum Total <?=number_format($SumTotal,2);?>
<br><br><a href="product.php">Go to Product</a>
<?
if($SumTotal > 0)
{
?>
| <a href="checkout.php">CheckOut</a>
<?
}
?>
<?
mysql_close();
?>
</body>
</html>
<?/* This code download from www.ThaiCreate.Com */ ?>
Tag : PHP, MySQL, HTML/CSS, JavaScript, Ajax, jQuery

|
|
 |
 |
 |
 |
Date :
2015-04-04 17:32:37 |
By :
san.saleah |
View :
3161 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|
|

|
Load balance : Server 02
|