รบกวนดู Code ให้ทีครับ คือตอนนี้กำลังทำโปรเจคเกี่ยวกับ POS ครับ
ครับผม
Date :
2009-12-08 14:50:44
By :
ปั๊กเป้า
คำถามมันชวนให้งงรึป่าวครับ
Date :
2009-12-08 18:17:31
By :
kasmaura_IT
ไม่แน่ใจใช่ส่วนนี้ป่ะครับ เป็นโค๊ดหน้า Add_Product
<?
if(!isset($_POST['productId']))exit;
switch($_POST['productId']){
case "1";
echo "1|||Compaq|||25000";
break;
case "2";
echo "2|||apple|||35000";
break;
case "3";
echo "3|||acer|||28500";
break;
case "4";
echo "4|||Dell|||28000";
break;
case "5";
echo "5|||Benq|||26000";
break;
case "6";
echo "6|||Sony Vaio|||35000";
break;
}
?>
Date :
2009-12-08 21:16:50
By :
kasamura_IT
ส่วนหน้านี้เป็นหน้า form ทั้งหมดเลยครับ (คือตอนนี้ไม่รู้จะเอาตรงไหนให้ดูเลยเอามา 2 อันเลยครับ)
<html>
<head>
<script type="text/javascript" src="clienthint.js"></script>
<script type="text/javascript" src="selectuser.js"></script>
<script type="text/javascript" src="js/ajax.js"></script>
<script type="text/javascript" src="js/pos.js"></script>
<script type="text/javascript">
function writeText(txt)
{
document.getElementById("desc").innerHTML=txt;
}
</script>
<style type="text/css">
<!--
.clear { clear:both;
}
.product_container { width:190px;
margin-right:15px;
float:left;
margin-top:3px;
padding:2px;
}
.style4 {color: #009900; font-weight: bold; }
body {
background-color: #FFFFFF;
background-image: url();
background-repeat: no-repeat;
}
.style7 {
color: #999999;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
.style9 {
font-size: 36px;
font-weight: bold;
color: #009900;
font-family: Arial, Helvetica, sans-serif;
}
.style10 {
color: #333333;
font-weight: bold;
}
.style13 {color: #333333}
.style14 {
color: #FF9500
}
.style15 {
color: #CCCCCC;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
.style16 {color: #CCCCCC}
.style17 {color: #999999; font-weight: bold; }
a:link {
color: #666666;
}
a:hover {
color: #CCCCCC;
}
a:visited {
color: #666666;
}
a:active {
color: #666666;
}
.style18 {font-family: Arial, Helvetica, sans-serif}
.style19 {
color: #666666;
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
}
.style23 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
.style25 {color: #333333; font-size: 12px; }
.style26 {font-size: 12px}
.style28 {
color: #CCCCCC;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 14px;
}
.style29 {color: #CCCCCC; font-weight: bold; }
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<table width="1072" border="0" align="center">
<tr>
<td><p align="center"> </p> </td>
<td><p> </p>
<p> </p> </td>
<td> </td>
</tr>
<tr>
<td width="94"> </td>
<td width="858"><table width="858" border="0" align="center" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
<tr>
<td colspan="3" bgcolor="#333333"><p align="left" class="style9 style14"><span class="style16">POINT OF SALE . .</span><br>
</p>
<p align="right" class="style7">Shopping cart <img src="images/ip.gif" width="16" height="16"></p></td>
</tr>
<tr>
<td width="129" rowspan="2" valign="top" bgcolor="#333333"><div align="center"><span class="style7">Main menu</span></div></td>
<td width="538" valign="top" bgcolor="#333333">
<?php
echo"<form>"
. " <div align=\"center\" class=\"style17\"> Product_id:"
. " <input type=\"text\" id=\"txt2\" onKeyup=\"addToBasket(4);return false\" />"
. " </div>"
. " </form>"
."";
?>
</td>
<td width="177" rowspan="3" valign="top" bgcolor="#CCCCCC"><div id="shopping_cart">
<p class="style4"><span class="style13">Shopping cart</span><br>
<img src="images/shop.png" alt="shopping cart" class="pngfix" width="128" height="128" /><br>
</p>
<table id="shopping_cart_items">
<tr>
<th width="38"><span class="style25">Items</span></th>
<th width="77"><span class="style25">Description</span></th>
<th width="43"><span class="style25">Price</span></th>
<th width="10"><span class="style26"></span></th>
</tr>
</table>
<table width="136" border="0" align="center">
<tr>
<td bgcolor="#333333"><div align="center"><span class="style15"><a href="order.php">Checkout</a></span></div></td>
</tr>
</table>
<p>
<?php
echo date("Y/m/d") . "<br />";
?>
</p>
<div id="shopping_cart_totalprice"></div>
</div></td>
</tr>
<tr>
<td height="207" rowspan="2" valign="top"><table width="641" height="144" border="0" align="center">
<tr>
<td colspan="3" valign="top"><p class="style10">Notebook center: <span id="txtHint"></span></p>
<p> </p>
<p> </p></td>
</tr>
<tr>
<td width="209" valign="top"><div class="product_container">
<div class="sliding_product" id="slidingProduct4"> <img src="images/104.jpg" width="121" height="85"><br>
<span class="style18">Dell<br>
28,000.00 </span></div>
<a href="#" onClick="addToBasket(4);return false"><img src="images/add_cart.gif" border="0"></a>
<div class="clear"></div>
</div></td>
<td width="209" valign="top"><div class="product_container">
<div class="sliding_product" id="slidingProduct5"> <img src="images/105.jpg" width="133" height="80"><br>
<span class="style18">Benq<br>
26,000.00 </span></div>
<a href="#" onClick="addToBasket(5);return false"><img src="images/add_cart.gif" border="0"></a>
<div class="clear"></div>
</div></td>
<td width="209" valign="top"><div class="product_container">
<div class="sliding_product" id="slidingProduct6"> <img src="images/106.jpg" width="116" height="85"><br>
<span class="style18">Sony vaio<br>
35,000.00 </span></div>
<a href="#" onClick="addToBasket(6);return false"><img src="images/add_cart.gif" border="0"></a>
<div class="clear"></div>
</div></td>
</tr>
<tr>
<td valign="top"><div class="product_container">
<div class="sliding_product" id="slidingProduct2"> <img src="images/101.jpg" width="100" height="87"><br>
<span class="style18">apple<br>
35,000.00 </span></div>
<a href="#" onClick="addToBasket(2);return false"><img src="images/add_cart.gif" border="0"></a>
<div class="clear"></div>
</div></td>
<td valign="top"><div id="slidingProduct3" class="sliding_product"><img src="images/103.jpg" width="106" height="87"><br>
<span class="style18">acer<br>
28,500.00 </span></div>
<a href="#" onClick="addToBasket(3);return false;"><img src="images/add_cart.gif" border="0"></a></td>
<td valign="top"><div id="slidingProduct1" class="sliding_product"><img src="images/102.jpg" width="100" height="87"><br>
<span class="style18">compaq<br>
25,000.00 </span></div>
<a href="#" onClick="addToBasket(1);return false;"><img src="images/add_cart.gif" border="0"></a></td>
</tr>
<tr>
<td colspan="3" valign="top"><div class="clear"></div></td>
</tr>
<tr>
<td colspan="3" valign="top"> </td>
</tr>
<tr>
<td colspan="3" valign="top"><img src="images/banner.jpg" alt="Planets" width="680" height="116" border="0" usemap="#planetmap"></td>
</tr>
<tr>
<td colspan="3" valign="top"><p id="desc"></p></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top" bgcolor="#CCCCCC"><table width="126" border="0" align="center">
<tr>
<td width="120" bgcolor="#333333"><div align="center" class="style28">Report Item</div></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><form>
<div align="center">
<select name="users2" onChange="showUser(this.value)">
<option value="101">apple</option>
<option value="102">Hp&compaq</option>
<option value="103">acer</option>
<option value="104">Dell</option>
<option value="105">Benq</option>
<option value="106">Sony Vaio</option>
</select>
</div>
</form></td>
</tr>
<tr>
<td bgcolor="#333333"><span class="style28">Add and Remove</span></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><span class="style23">-<a href="insert.html"> Add Item</a></span></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><span class="style23">- <a href="Delete.html">Delete</a></span></td>
</tr>
<tr>
<td bgcolor="#333333"><div align="center" class="style16"><span class="style29">Product_id: </span></div></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><form>
<div align="center" class="style17">
<input type="text" id="txt2" onKeyUp="showHint(this.value)" />
</div>
</form></td>
</tr>
<tr>
<td bgcolor="#CCCCCC"></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="106"> </td>
</tr>
<tr>
<td rowspan="2"> </td>
<td></td>
<td rowspan="2"> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="center"><span class="style19">Copyring © 2009 by spartans Team</span></div></td>
</tr>
</table>
<map name="planetmap">
<area shape ="circle" coords ="627,55,29"
onMouseOver="writeText('apple')"
href ="mercur.htm" target ="_blank" alt="Mercury" />
<area shape ="circle" coords ="523,49,29"
onMouseOver="writeText('Compaq')"
href ="mercur.htm" target ="_blank" alt="Mercury" />
<area shape ="circle" coords ="392,53,29"
onMouseOver="writeText('acer')"
href ="mercur.htm" target ="_blank" alt="Mercury" />
<area shape ="circle" coords ="295,47,29"
onMouseOver="writeText('Dell')"
href ="mercur.htm" target ="_blank" alt="Mercury" />
<area shape ="circle" coords ="170,37,29"
onMouseOver="writeText('Benq')"
href ="mercur.htm" target ="_blank" alt="Mercury" />
<area shape ="circle" coords ="64,53,29"
onMouseOver="writeText('The Sony Vaio .')"
href ="mercur.htm" target ="_blank" alt="Mercury" />
<area shape ="circle" coords ="382,156,29"
onMouseOver="writeText('The planet Mercury is very difficult to study from the Earth because it is always so close to the Sun.')"
href ="mercur.htm" target ="_blank" alt="Mercury" />
</map>
<p> </p>
</body>
</html>
ถ้าผมให้โค๊ดไปผิดบอกด้วยนะครับ ขอบคุณครับ
Date :
2009-12-08 21:21:01
By :
kasamura_IT
เท่าที่ผมเข้าใจคืออยากให้มันโชว์ภายใน form ประมาณนี้ครับ
ถ้าเราค้นหา id 101 จะ run onKeyUp=\"addToBasket(1);return false\" น่ะครับ
id 102 run onKeyUp=\"addToBasket(2);return false\"
id 103 run onKeyUp=\"addToBasket(3);return false\"
ผมลองทำดูแล้วมัน error บ่อยมากอ่าครับยังทำไม่ได้เลย พอดีต้องใช้ในงาน project วิชาเรียน รบกวนพี่ๆด้วยนะครับ
Date :
2009-12-09 09:27:33
By :
Kasmaura_IT
Load balance : Server 03