Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head><meta charset="UTF-8">
- <title>รายการที่สั่ง</title>
- <link rel="stylesheet" href="css/productdemoo.css">
- </head>
- <br><br><br><br>
- <div align="center">
- <body>
- <h1><font face="AgaraDull">รายการสินค้าทีี่สั่งซื้อ</font></h1>
- <br>
- <?php
- //หัวข้อตาราง
- echo"<form action='send.php' method='post'>";
- $con=mysqli_connect("localhost","root","","testorder");
- /*if($con!=null)
- echo"Sucess";*/
- $result=mysqli_query($con,"SELECT * FROM list" );
- if(!$result)
- die("connot");
- $p=0;
- $c;
- echo "<table border=1>";
- while($row=mysqli_fetch_array($result,MYSQLI_NUM))
- {
- for($i=0; $i< 4 ;$i++)
- {
- $c[$p][$i]=$row[$i];
- }
- $p++;
- }
- /*for($i=0; $i< 6 ;$i++)
- {
- echo "<tr>";
- for($j=0; $j< 4 ;$j++)
- {
- echo "<td>".$c[$i][$j]."</td></br>";
- }
- echo "</tr>";
- }*/
- $data=array("ลำดับ","รหัสรายการ","ประเภท","ราคา","จำนวน","ราคารวม" );
- echo"<table border=0>";
- echo"<tr bgcolor=#ffcc00>";
- for($i=0; $i<count($data) ; $i++)
- echo"<td>".$data[$i]."</td>";
- echo"</tr>";
- // =========================================================================
- $cheak=array(0,0,0,0,0,0); // เชคการแสดงข้อความ
- // =========================================================================
- echo"<tr bgcolor=#ffffff>";
- echo"<td>".$c[0][0]."</td>";
- echo"<td>".$c[0][1]."</td>";
- echo"<td>".$c[0][2]."</td>";
- echo"<td>".$c[0][3]."</td>";
- $tmp=0;
- if($_POST['user_pass1']>0)
- {
- $cheak[0]=1;
- echo"<td>".$_POST['user_pass1']."</td>";
- echo"<input type=hidden value=". $_POST['user_pass1'] ." name=at[0]>";
- }
- else
- echo"<td>0</td>";
- if($cheak[0]==1)
- echo"<input type=hidden value=0 name=gg[0]>";
- else if($cheak[0]==0)
- echo"<input type=hidden value='-1' name=gg[0]>";
- $result1=$_POST['user_pass1']*35;
- echo"<input type=hidden value=". $result1 ." name=total[0]>";
- echo"<input type=hidden value='001' name=IDType[0]>";
- echo"<input type=hidden value='freshmilk' name= 0]'>";
- echo"<input type=hidden value=". '35'." name='price[0]'>";
- echo"<td>".$result1."</td>";
- echo"</tr>";
- echo"<tr bgcolor=#ffff99>";
- echo"<td>".$c[1][0]."</td>";
- echo"<td>".$c[1][1]."</td>";
- echo"<td>".$c[1][2]."</td>";
- echo"<td>".$c[1][3]."</td>";
- $tmp=0;
- if($_POST['user_pass2']>0)
- {
- $cheak[1]=1;
- echo"<td>".$_POST['user_pass2']."</td>";
- echo"<input type=hidden value=".$_POST['user_pass2']." name=at[1]>";
- }
- else
- echo"<td>0</td>";
- if($cheak[1]==1)
- echo"<input type=hidden value=1 name=gg[1]>";
- else if($cheak[1]==0)
- echo"<input type=hidden value='-1' name=gg[1]>";
- $result2=$_POST['user_pass2']*40;
- echo"<input type=hidden value=". $result2 ." name=total[1]>";
- echo"<input type=hidden value='002' name='IDType[1]'>";
- echo"<input type=hidden value='greentea' name='Type[1]'>";
- echo"<input type=hidden value=". '40'." name='price[1]'>";
- echo"<td>".$result2."</td>";
- echo"</tr>";
- echo"<tr bgcolor=#ffffff>";
- echo"<td>".$c[2][0]."</td>";
- echo"<td>".$c[2][1]."</td>";
- echo"<td>".$c[2][2]."</td>";
- echo"<td>".$c[2][3]."</td>";
- if($_POST['user_pass3']>0)
- {
- $cheak[2]=1;
- echo"<td>".$_POST['user_pass3']."</td>";
- echo"<input type=hidden value=". $_POST['user_pass3'] ." name=at[2]>";
- }
- else
- echo"<td>0</td>";
- if($cheak[2]==1)
- echo"<input type=hidden value=2 name=gg[2]>";
- else if($cheak[2]==0)
- echo"<input type=hidden value='-1' name=gg[2]>";
- $result3=$_POST['user_pass3']*40;
- echo"<input type=hidden value=". $result3 ." name=total[2]>";
- echo"<input type=hidden value='003' name='IDType[2]'>";
- echo"<input type=hidden value='pink milk' name='Type[2]'>";
- echo"<input type=hidden value=". '40'." name='price[2]'>";
- echo"<td>".$result3."</td>";
- echo"</tr>";
- echo"<tr bgcolor=#ffff99>";
- echo"<td>".$c[3][0]."</td>";
- echo"<td>".$c[3][1]."</td>";
- echo"<td>".$c[3][2]."</td>";
- echo"<td>".$c[3][3]."</td>";
- if($_POST['user_pass4']>0)
- {
- $cheak[3]=1;
- echo"<td>".$_POST['user_pass4']."</td>";
- echo"<input type=hidden value=". $_POST['user_pass4'] ." name=at[3]>";
- }
- else
- echo"<td>0</td>";
- if($cheak[3]==1)
- echo"<input type=hidden value=3 name=gg[3]>";
- else if($cheak[3]==0)
- echo"<input type=hidden value='-1' name=gg[3]>";
- $result4=$_POST['user_pass4']*35;
- echo"<input type=hidden value=". $result4 ." name=total[3]>";
- echo"<input type=hidden value='004' name='IDType[3]'>";
- echo"<input type=hidden value='Iced tea' name='Type[3]'>";
- echo"<input type=hidden value=". '35'." name='price[3]'>";
- echo"<td>".$result4."</td>";
- echo"</tr>";
- echo"<tr bgcolor=#ffffff>";
- echo"<td>".$c[4][0]."</td>";
- echo"<td>".$c[4][1]."</td>";
- echo"<td>".$c[4][2]."</td>";
- echo"<td>".$c[4][3]."</td>";
- $tmp=0;
- if($_POST['user_pass5']>0)
- {
- $cheak[4]=1;
- echo"<td>".$_POST['user_pass5']."</td>";
- echo"<input type=hidden value=". $_POST['user_pass5'] ." name=at[4]>";
- }
- else
- echo"<td>0</td>";
- if($cheak[4]==1)
- echo"<input type=hidden value=4 name=gg[4]>";
- else if($cheak[4]==0)
- echo"<input type=hidden value='-1' name=gg[4]>";
- $result5=$_POST['user_pass5']*35;
- echo"<input type=hidden value=". $result5 ." name=total[4]>";
- echo"<input type=hidden value='005' name='IDType[4]'>";
- echo"<input type=hidden value='Ovaltine' name='Type[4]'>";
- echo"<input type=hidden value=". '35'." name='price[4]'>";
- echo"<td>".$result5."</td>";
- echo"</tr>";
- echo"<tr bgcolor=#ffff99>";
- echo"<td>".$c[5][0]."</td>";
- echo"<td>".$c[5][1]."</td>";
- echo"<td>".$c[5][2]."</td>";
- echo"<td>".$c[5][3]."</td>";
- $tmp=0;
- if($_POST['user_pass6']>0)
- {
- $cheak[5]=1;
- echo"<td>".$_POST['user_pass6']."</td>";
- echo"<input type=hidden value=". $_POST['user_pass6'] ." name=at[5]>";
- echo"<input type=hidden value=". $cheak[5] ." name=c[5]>";
- }
- else
- echo"<td>0</td>";
- if($cheak[5]==1)
- echo"<input type=hidden value=5 name=gg[5]>";
- else if($cheak[5]==0)
- echo"<input type=hidden value='-1' name=gg[5]>";
- $result6=$_POST['user_pass6']*35;
- echo"<input type=hidden value=". $result6 ." name=total[5]>";
- echo"<input type=hidden value='006' name='IDType[5]'>";
- echo"<input type=hidden value='cocoa' name='Type[5]'>";
- echo"<input type=hidden value=". '35'." name='price[5]'>";
- echo"<td>".$result6 ."</td>";
- echo"</tr>";
- echo"</table>";
- echo "<br/ ><br/>";
- echo"<input type='submit' value='ยืนยัน'> ";
- echo "<br/>";
- echo"<br/><input type='button' onClick='window.history.back()' value='ย้อนกลับ'>";
- echo"</form>";
- $Type=array("นมสด","ชาเขียว","ชานมชมพู","ชาเย็น","โอวัลติน","โกโก้");
- $sumAll=null;
- for($j=0; $j< 6; $j++)
- {
- if($cheak[$j]==1 && $j==0)
- {
- echo"คุณสั่งซื้อ ".$Type[$j]. " ราคา 35 บาท เป็นจำนวน ".$_POST['user_pass1']." แก้ว ทั้งหมดราคา ".$result1 ." บาท<br/>" ;
- $sumAll=$sumAll+$result1;
- }
- if($cheak[$j]==1 && $j==1)
- {
- echo"คุณสั่งซื้อ ".$Type[$j]. " ราคา 40 บาท เป็นจำนวน ".$_POST['user_pass2']." แก้ว ทั้งหมดราคา ".$result2 ." บาท<br/>" ;
- $sumAll=$sumAll+$result2;
- }
- if($cheak[$j]==1 && $j==2)
- {
- echo"คุณสั่งซื้อ ".$Type[$j]. " ราคา 40บาท เป็นจำนวน ".$_POST['user_pass3']." แก้ว ทั้งหมดราคา ".$result3 ." บาท<br/>" ;
- $sumAll=$sumAll+$result3;
- }
- if($cheak[$j]==1 && $j==3)
- {
- echo"คุณสั่งซื้อ ".$Type[$j]. " ราคา 35 บาท เป็นจำนวน ".$_POST['user_pass4']." แก้ว ทั้งหมดราคา ".$result4 ." บาท<br/>" ;
- $sumAll=$sumAll+$result4;
- }
- if($cheak[$j]==1 && $j==4)
- {
- echo"คุณสั่งซื้อ ".$Type[$j]. " ราคา 35 บาท เป็นจำนวน ".$_POST['user_pass5']." แก้ว ทั้งหมดราคา ".$result5 ." บาท<br/>" ;
- $sumAll=$sumAll+$result5;
- }
- if($cheak[$j]==1 && $j==5)
- {
- echo"คุณสั่งซื้อ ".$Type[$j]. " ราคา 35 บาท เป็นจำนวน ".$_POST['user_pass6']." แก้ว ทั้งหมดราคา ".$result6 ." บาท<br/>" ;
- $sumAll=$sumAll+$result6;
- }
- }
- if($sumAll==0)
- echo "คุณยังไม่ได้สั่งสินค้า<br/>";
- else
- echo "รวมทั้งสิ้นเป็นเงิน ".$sumAll."บาท <br/>";
- ?>
- </body>
- </html>
- <body bgcolor="#33cc99">
Advertisement
Add Comment
Please, Sign In to add comment