|
|
|
จะเพิ่มหัวข้อสำหรับตัวเลือก (select) ต้องใส่โค้ดยังไง แนะนำด้วยค่ะ |
|
|
|
|
|
|
|
จากรูป และโค้ด ถ้าต้องการให้เพิ่มคำว่า
บริการขนส่ง
ส่งทางไปรษณีย์
ต้องเพิ่มโค้ดยังไง
ขอบคุณค่ะ
............................
Code (PHP)
<?php
session_start();
include "function.php";
include "dbconfig.php";
include "config.php";
conndb();
$member_id = $_SESSION['member_id_login'];
if($member_id != "")
{
$query_db = "select * from member where member_id='$member_id'";
$result_db = mysql_query($query_db);
$row_db = mysql_fetch_array($result_db);
$email_from_db = $row_db['email'];
$fullname_from_db = $row_db['fullname'];
$tel_from_db = $row_db['tel'];
$address_from_db = $row_db['address'];
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<title>Your Shopping Cart</title>
<STYLE type=text/css>
A:link { color: #0000cc; text-decoration:none}
A:visited {color: #0000cc; text-decoration: none}
A:hover {color: red; text-decoration: none}
</STYLE>
<style type="text/css">
<!--
small { font-family: Arial, Helvetica, sans-serif; font-size: 8pt; }
input, textarea { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; }
b { font-family: Arial, Helvetica, sans-serif; font-size: 11pt; }
big { font-family: Arial, Helvetica, sans-serif; font-size: 14pt; }
strong { font-family: Arial, Helvetica, sans-serif; font-size: 11pt; font-weight : extra-bold; }
font, td { font-family: Arial, Helvetica, sans-serif; font-size: 11pt; }
BODY { font-size: 9pt; font-family: Arial, Helvetica, sans-serif; }
-->
</style>
<script language="JavaScript" type="text/javascript">
function checkform ( form )
{
if (form.fullname.value == "") {
alert( "Please fill in your name-surname !!" );
form.fullname.focus();
return false ;
}
if (form.tel.value == "") {
alert( "Please fill in the phone number as well !!" );
form.tel.focus();
return false ;
}
if (form.email.value == "") {
alert( "Please complete the email as well !!" );
form.email.focus();
return false ;
}
if (form.send_method_id.value == "") {
alert( "Please choose the shipping method as well !!" );
form.send_method_id.focus();
return false ;
}
if (form.address.value == "") {
alert( "Please fill in the shipping address as well !!" );
form.address.focus();
return false ;
}
return true ;
}
</script>
</head>
<body>
<center>
<div id="shoppingCartDisplay">
<center><img src="images/shopping_cart_header.gif"></center>
<table width="750" border="1" style="border-collapse: collapse;" bordercolor="#111111" cellpadding="0" cellspacing="0">
<tr height="30">
<td bgcolor="#FFFFCC" width="7%"><font color="#000080"><b><center>No.</center></b></font></td>
<td bgcolor="#FFFFCC" width="43%"><font color="#000080"><b><center>Name Procuct</center></b></font></td>
<td bgcolor="#FFFFCC" width="15%"><font color="#000080"><b><center>Price</center></b></font></td>
<td bgcolor="#FFFFCC" width="15%"><font color="#000080"><b><center>Total</center></b></font></td>
<td bgcolor="#FFFFCC" width="15%"><b><font color="#000080"><center>Total price</center></b></font></td>
</tr>
<?php
$no =1;
//Print all the items in the shopping cart
foreach ($_SESSION['SHOPPING_CART'] as $itemNumber => $item) {
?>
<tr id="item<?php echo $itemNumber; ?>" height="30">
<td bgcolor="#CCFFFF"><div align="center"><?=$no; ?></div></td>
<td bgcolor="#CCFFFF"><div align="left"> <?php echo $item['name']; ?> </div></td>
<td bgcolor="#CCFFFF"><div align="center"><?php echo number_format($item['price'],2,'.',','); ?> </div></td>
<td bgcolor="#CCFFFF"><div align="center"><?php echo number_format($item['qty'],0,'.',','); ?></div></td>
<td bgcolor="#CCFFFF"><div align="right"><?php echo number_format($item['qty'] * $item['price'],2,'.',','); ?> </div></td>
</tr>
<?php
$no++;
}
?>
<tr id="itemtotal" height="30">
<td bgcolor="#FFFFCC" colspan="4" align="left">
<b><font color="red"> Total price</font></b></td>
<td bgcolor="#FFFFCC" colspan="2">
<div align="right"><b><font color="red"><? echo number_format($_SESSION['total'],2,'.',','); ?> baht </font></b></div></td>
</tr>
<?
if($use_vat == 1)
{
?>
<tr id="itemvat" height="30">
<td bgcolor="#FFFFCC" colspan="4" align="left">
<b><font color="red"> vat (7%)</font></b></td>
<td bgcolor="#FFFFCC" colspan="2">
<div align="right"><b><font color="red"><? echo number_format($_SESSION['total']*0.07,2,'.',','); ?> baht </font></b></div></td>
</tr>
<tr id="itemnettotal" height="30">
<td bgcolor="#FFFFCC" colspan="4" align="left">
<b><font color="red"> VAT included (7%)</font></b></td>
<td bgcolor="#FFFFCC" colspan="2">
<div align="right"><b><font color="red"><? echo number_format($_SESSION['total'] + ($_SESSION['total']*0.07),2,'.',','); ?> baht </font></b></div></td>
</tr>
<?
}
?>
</table>
<br>
<center>
<form name="frm" id="frm" action="confirm_order2.php" method="post" enctype="multipart/form-data" onsubmit="return checkform(this);">
<INPUT type="hidden" name="member_id" value="<?=$member_id; ?>">
<table border="0" cellpadding="2" cellspacing="0" width="60%" style="border-collapse: collapse" bordercolor="#111111">
<tr bgcolor="#FFFFCC" height="40">
<td width="100%" colspan="3"><div align="center"><b>:: Order information ::</b></div>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="3"> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="36%" align="left"> Name</td>
<td width="5%" align="center">:</td>
<td width="60%" align="left"><INPUT type="text" name="fullname" size="40" value="<?=$fullname_from_db; ?>" maxlength="200"> <font color=red>*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="left"> Phone</td>
<td align="center">:</td>
<td align="left"><INPUT type="text" name="tel" size="40" value="<?=$tel_from_db; ?>" maxlength="100"> <font color=red>*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="left"> Email</td>
<td align="center">:</td>
<td align="left"><INPUT type="text" name="email" size="40" value="<?=$email_from_db; ?>" maxlength="100"> <font color=red>*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="left"> Delivery method</td>
<td align="center">:</td>
<td align="left"><select name="send_method_id">
<option value="" selected>-------------------select -------------------</option>
<?
$strSQL1 = "SELECT * FROM send_method_tb ORDER BY order_list DESC";
$result1 = mysql_query($strSQL1);
While($row1 = mysql_fetch_array($result1)){
?>
<option value="<?=$row1['id']; ?>"><?=$row1['method_name']; ?></option>
<?
}
?>
</select> <font color=red>*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="left" valign="top"> Shipping address</td>
<td align="center" valign="top">:</td>
<td align="left"><textarea name="address" id="address" wrap="VIRTUAL" style="width: 232px; height: 50px"><?=$address_from_db; ?></textarea> <font color=red>*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="left" valign="top"> notes</td>
<td align="center" valign="top">:</td>
<td align="left"><textarea name="remarks" id="remarks" wrap="VIRTUAL" style="width: 232px; height: 50px"></textarea></td>
</tr>
<tr bgcolor="#FFFFFF" height="50">
<td width="100%" colspan="3"><div align="center"><input type="submit" name="submit_bt" id="submit_bt" value="submit"> <input type="reset" name="reset_bt" id="reset_bt" value="reset"></div>
</td>
</tr>
</table>
</form>
</div>
</center>
</body>
</html>
Tag : PHP, MySQL, HTML, JavaScript, Windows
|
|
|
|
|
|
Date :
2019-01-15 15:31:54 |
By :
2015381758558256 |
View :
646 |
Reply :
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<option value="<?=$row1['id']; ?>"><?=$row1['method_name']; ?></option>
มันดึงมาจากฐานข้อมูลไม่ใช่เหรอ? ต้องไปเพิ่มในฐานข้อมูลสิครับ
|
|
|
|
|
Date :
2019-01-15 15:35:29 |
By :
mr.v |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ถ้ามันมีหน้า admin มีการจัดการมาให้ ก็เพิ่มตรงนั้น
ถ้าไม่มีก็จัดการผ่าน mysql management นั่นแหละ
ปกติการเพิ่มลบข้อมูลทำตรงไหนก็ตรงนั้นเหมือนกันแหละ
|
|
|
|
|
Date :
2019-01-16 10:58:34 |
By :
mr.v |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เย้ !!! ได้แล้วค่ะ เพิ่มในแอดมินนี่เอง ขอบคุณ mr.v มากนะคะ
|
|
|
|
|
Date :
2019-01-16 11:23:18 |
By :
2015381758558256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|