0

嗨,我是编程新手。。我在这些列表中列出了一个复选框在分页中检索复选框的值??一些教程说使用 ajax .. 但我不熟悉它...另一方面,一些教程说使用会话 .. 但我不知道应该在哪里使用我的复选框 Pengadaan.php 确定会话变量:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Input Bobot Kriteria</title>
    <script type="text/JavaScript">
    <!--
    function MM_jumpMenu(targ,selObj,restore){ //v3.0
      eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
      if (restore) selObj.selectedIndex=0;
    }
    //-->
    </script>
    </head>
    <body>
    <?
    include "../konfigurasi/koneksi.php";
    $aksi="aksi_pengadaan.php";
    switch ($_GET[act]){
    //case "hitung"
    default
    ?>
    <br /><br/>
    <font face="Arial, Helvetica, sans-serif" size="+2"><p align="center">Data Pengadaan Buku</p></font>
    <table class=datatable2 align=center >
    <? 
     echo"<form method=POST action=$aksi?page=pengadaan&act=hitung>";
     // 
    ?>
     <tr><td align=center><font size=-1 face=Arial, Helvetica, sans-serif >Budget</font></td><td> : <input type=text name='budget'></td></tr>
    </table>
    <br />

    <table border="0" >
    <tr><td><font size="-1.5">*Daftar Rekomendasi Permintaan Buku</font></td></tr>
    </table>
    <table class="datatable" align="center">
    <tr>
    <td bgcolor="#333333"><p align="center"><font size="-1" face="Arial, Helvetica, sans-serif" color="#FFFFFF" >NO</font></p></td>
    <td bgcolor="#333333"></td>
    <td bgcolor="#333333"><p align="center"><font size="-1" face="Arial, Helvetica, sans-serif" color="#FFFFFF" >ISBN</font></p></td>
    <td bgcolor="#333333"><p align="center"><font size="-1" face="Arial, Helvetica, sans-serif" color="#FFFFFF" >JUDUL</font></p></td>
     <td bgcolor="#333333"><p align="center"><font size="-1" face="Arial, Helvetica, sans-serif" color="#FFFFFF" >STOK</font></p></td>
    <td bgcolor="#333333"><p align="center"><font size="-1" face="Arial, Helvetica, sans-serif" color="#FFFFFF" >FREKUENSI</font></p></td>
    <td bgcolor="#333333"><p align="center"><font size="-1" face="Arial, Helvetica, sans-serif" color="#FFFFFF" >EKS</font></p></td>
    <td bgcolor="#333333"><p align="center"><font size="-1" face="Arial, Helvetica, sans-serif" color="#FFFFFF" >HARGA</font></p></td>
    <td bgcolor="#333333"><p align="center"><font size="-1" face="Arial, Helvetica, sans-serif" color="#FFFFFF" >T.HARGA</font></p></td>
    <td bgcolor="#333333"><p align="center"><font size="-1" face="Arial, Helvetica, sans-serif" color="#FFFFFF" >KELOMPOK</font></p></td>
    <td bgcolor="#333333"><p align="center"><font size="-1" face="Arial, Helvetica, sans-serif" color="#FFFFFF" >BOBOT</font></p></td>
    <td bgcolor="#333333" colspan=2><p align="center"><font size="-1" face="Arial, Helvetica, sans-serif" color="#FFFFFF" >AKSI</font></p></td>
    </tr>
    <?
    $batas   = 10;
    $halaman = $_GET['halaman'];
    if(empty($halaman)){
        $posisi  = 0;
        $halaman = 1;
    }
    else{
        $posisi = ($halaman-1) * $batas;
    }
    //===============================================
    $p=ociparse($con,"SELECT COUNT(isbn) FROM pp_gabungan where isbn is not null");
            ociexecute($p);
            ocifetchinto($p,&$jml);
    //
    $sql="select isbn,judul,nvl(stok,0),nvl(frekuensi,0),eks,harga,(eks*harga),kelompok,bobot,prioritas from pp_gabungan order by kelompok asc";
        $s=ociparse($con,$sql);
        ociexecute($s);
        //ocifetchinto($s,&$a);
        $i=0;
        $j=0;
        while(ocifetchinto($s,$a)){
        if ($i>=$posisi) {
            if ($j <$batas) {
            echo "<tr>";
                  echo "<td align=center><font size=-2.3 face=Arial, Helvetica, sans-serif >".($i+1)."</font></td> ";
                  echo"<td align=center><font size=-2.3 face=Arial, Helvetica, sans-serif ><input type=checkbox name=cek[] value='$a[0]' id='$i'></font></td>";
                  echo "<td align=center><font size=-2.3 face=Arial, Helvetica, sans-serif >".$a[0]."</font></td> ";//ociresult($s,1)
                  echo "<td align=center><font size=-2.3 face=Arial, Helvetica, sans-serif >".$a[1]."</font></td> ";//ociresult($s,2)
                  echo "<td align=center><font size=-2.3 face=Arial, Helvetica, sans-serif >".$a[2]."</font></td> ";//ociresult($s,3)
                  echo "<td align=center><font size=-2.3 face=Arial, Helvetica, sans-serif >".$a[3]."</font></td> ";//ociresult($s,4)
                  echo "<td align=center><font size=-2.3 face=Arial, Helvetica, sans-serif >".$a[4]."</font></td> ";//ociresult($s,5)
                  echo "<td align=center><font size=-2.3 face=Arial, Helvetica, sans-serif >".$a[5]."</font></td> ";//ociresult($s,6)
                  echo "<td align=center><font size=-2.3 face=Arial, Helvetica, sans-serif >".$a[6]."</font></td> ";//ociresult($s,7)
                  echo "<td align=center><font size=-2.3 face=Arial, Helvetica, sans-serif >".$a[7]."</font></td> ";//ociresult($s,8)
                   echo "<td align=center><font size=-2.3 face=Arial, Helvetica, sans-serif >".$a[8]."</font></td> ";//ociresult($s,9)
                    //echo "<td align=center><font size=-2.3 face=Arial, Helvetica, sans-serif >".$a[9]."</font></td> ";//ociresult($s,9)
                 echo"<td><a href=?page=pengadaan&act=edit&id=".ociresult($s,1)."><font size=-1 face=Arial, Helvetica, sans-serif ><img src=img/edit.png ></a></td>";
    echo "</tr>";
     echo "";

                $j++;
                   }//end if j

        }//end if i



        $i++;   
    }//end while

    //===============================================
    $r=ociparse($con,"select nvl(jharga,0) from jharga where jharga is not null ");
    ociexecute($r);
    ocifetchinto($r,&$ro);
    echo"<tr><td colspan=12>Jumlah: ".$ro[0]." </td</tr>";
    echo"</table>";

    /////////==============Paging===================
    //Langkah 3: Hitung total data dan halaman 
    //$sql="select count (*)from pp_judul ";
    $sql="select count(*) from pp_gabungan";
    $a=ociparse($con,$sql);
    ociexecute($a);
    ocifetchinto($a,&$total_rows);
    $jmlhal=intval($total_rows[0]/$batas);
    $mulai=($posisi)+1;
    $akhir=($mulai+($batas-1));
    //$akhir=($total_rows[0]/$batas)*10;
    //======================
    echo"
            <input type=radio name=pilih onClick='for(i=0;i<$total_rows[0];i++){document.getElementById(i).checked=true;}'>Check All
            <input type=radio name=pilih onClick='for(i=0;i<$total_rows[0];i++){document.getElementById(i).checked=false;}'>Uncheck All

    ";

    echo"<font size=-1><p>Ada <b> $total_rows[0] </b> data </p>";
    echo"<p>Menampilkan data <b> $mulai </b> sampai <b> $akhir </b> </p></font>";
    echo"<font size=-1>|Halaman| : </font>";
    if($halaman > 1)
    {
        $prev=$halaman-1;
        echo "<a href=$_SERVER[PHP_SELF]?page=pengadaan&halaman=$prev>« Prev &nbsp</a> ";
    }

    // Tampilkan link halaman 1,2,3 ...
    for($i=1;$i<=$jmlhal;$i++)

    if ($i != $halaman){
        echo " <a href=$_SERVER[PHP_SELF]?page=pengadaan&halaman=$i>$i &nbsp</a> ";
    }
    else{
        echo " <span class=current>$i &nbsp</span> ";
    }
    // Link kehalaman berikutnya (Next)
    if($halaman < $jmlhal){
        $next=$halaman+1;
        echo "<span class=prevnext><a href=$_SERVER[PHP_SELF]?page=pengadaan&halaman=$next>Next »</a></span>";
    }
    if($halaman=$jmlhal){
    echo"<font size=-1></font><a href=$_SERVER[PHP_SELF]?page=pengadaan&halaman=$jmlhal>&nbsp Last </a></font>";
    }

    //===========Buget Comparisson=================================//
    $bud=$_POST['budget'];
    echo"<table class=datatable2 border=0>
    <tr><td clospan=12>";
    if ($ro[0] == 0){
    echo "<input type=submit class=button value='HITUNG' name=hitung  />
     <input  type=submit class=button value='CETAK' name=cetak hidden /> 
     <input  hidden type=submit class=button value='RESET' onclick=\"window.location.href='$aksi?page=pengadaan&act=ulang' ;\"><td></tr>
    ";
    }
    else if ($bud <= $ro[0])
    {
        echo "<input type=submit class=button value='HITUNG' name=hitung  />
        <input  type=submit class=button value='CETAK' name=cetak  /> 
         <input type=submit class=button value='RESET' onclick=\"window.location.href='$aksi?page=pengadaan&act=ulang';\"><td></tr>
    ";
    }
    else if ( $bud > $ro[0] )
    {
        echo "<input type=submit class=button value='HITUNG' name=hitung  />
        <input  type=submit class=button value='CETAK' name=cetak hidden /> 
         <input type=submit class=button value='RESET' onclick=\"window.location.href='$aksi?page=pengadaan&act=ulang';\"><td></tr>
    ";
    }

    echo"</table></form>";
    //=======Budget===============
    break;
    //=============End Of paging=============
    case "edit":
    $edit="SELECT isbn,judul,eks FROM pp_gabungan WHERE isbn='$_GET[id]'";
        $s=ociparse($con,$edit);
        ociexecute($s);
        ocifetchinto($s,&$r);
        echo "<font face=Arial, Helvetica, sans-serif size=+2><p align=center>Edit Rekomendasi Permintaan</p></font>
              <form method=POST action=$aksi?page=pengadaan&act=update>
              <input type=hidden name=id value='$r[0]'>
              <table class=datatable align=center>
              <tr><td>ISBN</td><td> : <input type=text readonly name='isbn' value='$r[0]'></td></tr>
              <tr><td>Judul</td><td> : <input type=text readonly name='judul' value='$r[1]'></td></tr>
              <tr><td>Eks</td><td> : <input type=text name='eks' value='$r[2]'></td></tr>
              <tr><td colspan=2><input type=submit value=Update class = button>
                                <input type=button class= button value=Batal onclick=self.history.back()></td></tr>
              </table></form>";
              break;

    }//end of switch
    ?>

    </body>
    </html>

`

4

0 回答 0