checkbox problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Originally posted by kei_ki7 View Post
    PHP Code:
    if(isset($_POST['check'])) {
        $id = $_POST['check'];
        $noc = count($id);
        $a = 0;
        for($i=0; $i < $noc; $i++)
        {
            $del = mysql_query("DELETE FROM ibwf_private WHERE id='".$id[$i]."'");
           if($del) $a++;
        }
        if($a>0){
            echo "$a/$noc Messages Deleted Successfully";
        }else{
            echo "Can't Delete Messages At The Moment";
        }
    } 
    
    I thnk you need this code in upper part.

    I'll take a test. Wait for a while


    Done testing,
    Hope it will work.

    PHP Code:
    echo "<head>";
      echo "<title>PM Inbox</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$white[0]\"/>";
      echo "</head>";
    
    if(isset($_POST['check'])) {
        $id = $_POST['check'];
        $noc = count($id);
        $a = 0;
        for($i=0; $i < $noc; $i++)
        {
            $del = mysql_query("DELETE FROM ibwf_private WHERE id='".$id[$i]."'");
           if($del) $a++;
        }
        if($a>0){
            $delMsg = "$a/$noc Messages Deleted Successfully";
        }else{
            $delMsg =  "Can't Delete Messages At The Moment";
        }
    }
    
    echo "<div class=\"top\">PM INBOX</div><hr/><div class=\"center\">";
    echo getshoutbox($sid);
    echo "</div></div><hr/><div class=\"nav\">PM Messages</div><hr/>";
    echo "<div class=\"center\"><a href=\"inbox_sendto.php\">Send PM</a> <a href=\"inbox.php?view=snt\">Sent Items</a> <a href=\"inbox_folder.php\">Archive</a></div><hr/><div>";
    
        $view = safe(cleanInput($_GET["view"]));
        //////ALL LISTS SCRIPT <<
        if($view=="")$view="all";
        if($page=="" || $page<=0)$page=1;
        $myid = getuid_sid($sid);
        $doit=false;
            $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."' AND folderid='0'"));
        $num_items = $noi[0]; //changable
        $items_per_page= 10;
        $num_pages = ceil($num_items/$items_per_page);
        if($page>$num_pages)$page= $num_pages;
        $limit_start = ($page-1)*$items_per_page;
        if($num_items>0)
        {
          if($doit)
          {
            $exp = "&amp;rwho=$myid";
          }else
          {
            $exp = "";
          }
        //changable sql
        if($view=="all")
      {
        $sql = "SELECT
                a.name, b.id, b.byuid, b.unread, b.starred FROM ibwf_users a
                INNER JOIN ibwf_private b ON a.id = b.byuid
                WHERE b.touid='".$myid."' AND b.folderid='0'
                ORDER BY b.timesent DESC
                LIMIT $limit_start, $items_per_page
        ";
      }else if($view=="snt")
      {
        $sql = "SELECT
                a.name, b.id, b.touid, b.unread, b.starred FROM ibwf_users a
                INNER JOIN ibwf_private b ON a.id = b.touid
                WHERE b.byuid='".$myid."'
                ORDER BY b.timesent DESC
                LIMIT $limit_start, $items_per_page
        ";
      }else if($view=="str")
      {
        $sql = "SELECT
                a.name, b.id, b.byuid, b.unread, b.starred FROM ibwf_users a
                INNER JOIN ibwf_private b ON a.id = b.byuid
                WHERE b.touid='".$myid."' AND b.starred='1'
                ORDER BY b.timesent DESC
                LIMIT $limit_start, $items_per_page
        ";
      }else if($view=="urd")
      {
        $sql = "SELECT
                a.name, b.id, b.byuid, b.unread, b.starred FROM ibwf_users a
                INNER JOIN ibwf_private b ON a.id = b.byuid
                WHERE b.touid='".$myid."' AND b.unread='1'
                ORDER BY b.timesent DESC
                LIMIT $limit_start, $items_per_page
        ";
      }
        
        $items = mysql_query($sql);
        echo mysql_error();
        while ($item = mysql_fetch_array($items))
        {
    $i++;
     $avlink = getavatar($item[2]);
          if($item[3]=="1")
          {
            $iml = "[_]";
          }else{
            if($item[4]=="1")
            {
                $iml = "[S]";
            }else{
    
            $iml = "[x]";
            }
          }
          $delete = "$item[1]";
          $lnk = "<form method=\"POST\" action=\"inbox.php\"><input type=\"checkbox\" name=\"check[]\" value=\"$item[1]\"><a href=\"inbox_readpm.php?pmid=$item[1]\">$iml$item[0]</a>";
          
          $pmtext = mysql_fetch_array(mysql_query("SELECT text FROM ibwf_private WHERE id='".$item[1]."'"));
          $mprev = (htmlspecialchars(strlen($pmtext[0])<20?$pmtext[0]:substr($pmtext[0], 0, 15)));
          //$mtext = parsepm($mprev, $sid);
          echo "$lnk: $mprev..";
          echo "<br/>";
    
    
        }
    
    echo "<hr />";
    echo $delMsg;
    echo "<input type=\"submit\" value=\"Submit\" name=\"submit\">
    </form></div><hr/>";
    
    $npage = $page+1;
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"inbox.php?page=$ppage&amp;view=$view$exp\">«Prev</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"inbox.php?page=$npage&amp;view=$view$exp\">Next»</a>";
        }
        echo "<br/>$page of $num_pages<br/>";
        if($num_pages>2)
        {
          $rets = "<form action=\"inbox.php\" method=\"get\">";
          $rets .= "Go To Page: <input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
    $rets .= "<input type=\"submit\" value=\"Go\"/>";
            $rets .= "<input type=\"hidden\" name=\"do\" value=\"$do\"/>";
            $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
             
            $rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>";
    $rets .= "</form>";
            echo $rets;
        }
    
    
    
        }else{
    
          echo "You Have No Private Messages<a href=\"inbox.php?do=sendto\">Send Message</a>";
    
        }
    
    
      ////// UNTILL HERE
    echo "<hr><div class=\"center\"><a href=\"inbox_sendto.php\">Send PM</a> <a href=\"javascript: history.go(-1)\">Exit PM</a> <a href=\"inbox.php?view=snt\">Sent Items</a> <a href=\"inbox_folder.php\">Archive</a> <a href=\"index.php\">Home</a></div>";
    $plc = mysql_fetch_array(mysql_query("SELECT saan FROM ibwf_users WHERE id='".$uid."'"));
    echo "<div class=\"footer\">";
    echo "$mysite</div>";
    echo "<div class=\"timer\"><a href=\"index.php?do=signoff\" accesskey=\"0\">LogOut</a> <a href=\"terms.php\" accesskey=\"1\">Help</a></div>";
    echo "<div class=\"timer\">Script Timer ";
    $load = microtime();
    print (number_format($load,5));
    echo "s";
    echo "</div>";
      echo "</body>";
      } 
    

    Still not working....

    Comment

    Working...
    X