เลือกจาก Dropdown ไปแสดงแบบ pagination
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา เลือกจาก Dropdown ไปแสดงแบบ pagination
เลือกจาก Dropdown ไปแสดงแบบ pagination
เมื่อเลือกตัวเลือกจาก dropdown แล้วมันแสดงหน้าแรก
พอกดเลือกหน้า 2 มันไม่แสดงผลลัพธ์

คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
ความคิดเห็นที่
1

ความคิดเห็นที่
2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | ไฟล์ list.php ........................ <html> <head> <link rel= "shortcut icon" href= "img/hh.png" > <title>List Ward</title> <link rel= "stylesheet" href= "https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" > <link rel= "stylesheet" href= "https://maxcdn.bootstrapcdn.com/bootswatch/3.3.6/lumen/bootstrap.min.css" > </head> <?php $strKeyword = null; if (isset( $_POST [ "NameWard" ])) { $strKeyword = $_POST [ "NameWard" ]; } ?> <?php $conn = oci_connect( 'admin' , 'admin' , '192.168.99.250/hy' , 'UTF8' ); // mysql_connect("localhost","root","root") or die(mysql_error()); // mysql_select_db("mydatabase"); ?> <body bgcolor= "#CCFF99" > <form action= "show.php" method= "post" name= "form1" target= "_blank" > List Ward <select name= "NameWard" id= "NameWard" value= "<?php echo $strKeyword;?>" > <option value= "" ><-- Please Select Ward --></option> <?php $sql = "SELECT * FROM places WHERE pt_place_type_code ='2'" ; $stid = oci_parse( $conn , $sql ); oci_execute( $stid ); while ( $row = oci_fetch_array( $stid ,OCI_BOTH)) { ?> <option value= "<?php echo $row[" PLACECODE "];?>" ><?php echo $row [ "HALFPLACE" ];?></option> <?php } ?> </select> <input name= "btnSubmit" type= "submit" value= "Submit" > </form> </body> </html> <?php // oci_free_statement($stid); // oci_close($oconn); ?> |

ความคิดเห็นที่
3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | ไฟล์ show.php ........................ <head> <link rel= "shortcut icon" href= "img/hh.png" > <meta http-equiv= "X-UA-Compatible" content= "IE=edge" > <meta name= "viewport" content= "width=device-width, initial-scale=1" > <title>รายชื่อผู้ป่วย</title> </head> <body> <?php $strKeyword = null; if (isset( $_POST [ "NameWard" ])) { $strKeyword = $_POST [ "NameWard" ]; } ?> <?php $objConnect = oci_connect( 'admin' , 'admin' , '192.168.99.250/hy' , 'UTF8' ); $strSQL1 = "SELECT ROW_NUMBER() OVER(ORDER BY dateadmit DESC) AS ROWNO, T.an,T.flname,T.bed_no,T.dateadmit FROM ipdtrans T where T.pla_placecode = '$strKeyword' AND datedisch IS NULL AND bed_no IS NOT NULL" ; $objParse = oci_parse ( $objConnect , $strSQL1 ); oci_execute ( $objParse ,OCI_DEFAULT); $Num_Rows = oci_fetch_all( $objParse , $Result ); $Per_Page = 5; // Per Page if (!isset( $_GET [ "Page" ])) { $Page =1; } else { $Page = $_GET [ "Page" ]; } $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 ; } $Row_End = $Per_Page * $Page ; if ( $Row_End > $Num_Rows ) { $Row_End = $Num_Rows ; } ?> Ward : <?php echo $_POST [ 'NameWard' ]; ?> <form name= "NameWard" method= "post" action= "<?php echo $_SERVER['SCRIPT_NAME'];?>" > <table width= "600" border= "1" > <tr> <th width= "91" > <div align= "center" >AN </div></th> <th width= "98" > <div align= "center" >Name </div></th> <th width= "198" > <div align= "center" >เตียง </div></th> <th width= "97" > <div align= "center" >วันที่ Admit </div></th> </tr> <?php $strSQL2 = "SELECT C.* FROM ($strSQL1) C WHERE C.ROWNO > $Page_Start AND C.ROWNO <= $Row_End" ; $objParse = oci_parse( $objConnect , $strSQL2 ); oci_execute ( $objParse ,OCI_DEFAULT); while ( $objResult = oci_fetch_array( $objParse ,OCI_ASSOC)) { ?> <tr> <td><div align= "center" ><?php echo $objResult [ "AN" ];?></div></td> <td><?php echo $objResult [ "FLNAME" ];?></td> <td><?php echo $objResult [ "BED_NO" ];?></td> <td><div align= "center" ><?php echo $objResult [ "DATEADMIT" ];?></div></td> </tr> <?php } ?> </table> <br> Total <?php echo $Num_Rows ;?> Record : <?php echo $Num_Pages ;?> Page : <?php if ( $Prev_Page ) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&NameWard=$strKeyword'><< Back</a> " ; } for ( $i =1; $i <= $Num_Pages ; $i ++){ if ( $i != $Page ) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&NameWard=$strKeyword'>$i</a> ]" ; } else { echo "<b> $i </b>" ; } } if ( $Page != $Num_Pages ) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&NameWard=$strKeyword'>Next>></a> " ; } oci_close( $objConnect ); ?> </form> </body> </html> |

ความคิดเห็นที่
4
ดูเนื้อหานี้เป็นแนวทาง
แนวทาง การค้นหาจาก หลายรูปแบบ และแบ่งหน้า อย่างง่าย
https://www.ninenik.com/content.php?arti_id=573 via @ninenik

ขอบคุณทุกการสนับสนุน
![]()