<? ob_start(); session_start(); 05.if(!isset($_SESSION["intLine"])) { $_SESSION["intLine"] = 0; $_SESSION["strProductID"][0] = $_GET["ProductID"]; $_SESSION["strQty"][0] = 1; header("location:show.php"); } else { $key = array_search($_GET["ProductID"], $_SESSION["strProductID"]); if((string)$key != "") { $_SESSION["strQty"][$key] = $_SESSION["strQty"][$key] + 1; } else { $_SESSION["intLine"] = $_SESSION["intLine"] + 1; $intNewLine = $_SESSION["intLine"]; $_SESSION["strProductID"][$intNewLine] = $_GET["ProductID"]; $_SESSION["strQty"][$intNewLine] = 1; } header("location:show.php"); } ?>
<html> <head> <title>ThaiCreate.Com</title> </head> <body> <? for($i=0;$i<=30;$i++) { $arr[$i] = $i * 10; } $Num_Rows = count($arr) - 1; $Per_Page = 5; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $Page_End = $Per_Page * $Page; IF ($Page_End > $Num_Rows) { $Page_End = $Num_Rows; } ?> <table width="200" border="1"> <tr> <th width="100"> <div align="center">Index </div></th> <th width="100"> <div align="center">Value </div></th> </tr> <? for($i=$Page_Start;$i<$Page_End;$i++) { ?> <tr> <td><div align="center"><?=$i?></div></td> <td><?=$arr[$i];?></td> </tr> <? } ?> </table> <br> Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> "; } ?> </body> </html>
<? for($i=0;$i<=30;$i++) { $_SESSION["strProductID"][$i] = "x".$i; } $Num_Rows = count($_SESSION["strProductID"]) - 1; $Per_Page = 5; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $Page_End = $Per_Page * $Page; IF ($Page_End > $Num_Rows) { $Page_End = $Num_Rows; } ?> <table width="200" border="1"> <tr> <th width="100"> <div align="center">Index </div></th> <th width="100"> <div align="center">Value </div></th> </tr> <? for($i=$Page_Start;$i<$Page_End;$i++) { ?> <tr> <td><div align="center"><?=$i?></div></td> <td><?=$_SESSION["strProductID"][$i];?></td> </tr> <? } ?> </table> <br> Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> "; } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง