Jump to content

Jquery directory tree check box delete form


neven

Recommended Posts

[/b]Hi people I'm having problem with inplementing a check box delete form in the jquery directory tree ....Realy I need help with this ! I am using

the php code below....

 

 

  • <!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" dir="ltr" lang="en-US">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>jQuery Drop Down Menu</title>
     
    <!-- CSS For The Menu -->
    <link rel="stylesheet" href="stylee.css" />
     
    </head>
    <body>
     
    <!-- Menu Start -->
    <div id="jQ-menu">
     
    <?php
    error_reporting(0);
    $path = "store/".$diro."/";
     
    function createDir($path = '.')
    {
    if ($handle = opendir($path))
    {
    echo "<ul>";
     
    while (false !== ($file = readdir($handle)))
    {
    if (is_dir($path.$file) && $file != '.' && $file !='..')
    printSubDir($file, $path, $queue);
    else if ($file != '.' && $file !='..')
    $queue[] = $file;
    }
     
    printQueue($queue, $path);
    echo "</ul>";
    }
    }
     
    function printQueue($queue, $path)
    {
    foreach ($queue as $file)
    {
    printFile($file, $path);
    }
    }
    echo"<form action='osnovni_dokumenti.php?id=" . $data['ideo']. "' method='POST'>";
    function printFile($file, $path)
    {
     
    echo "<li><input type='checkbox' name='del[]' value='$file'/><a href=\"".$path.$file."\"><img src='slike_izgled/file.png'> $file</a></li>";
     
    }
     
    function printSubDir($dir, $path)
    {
    echo "<li><img src='slike_izgled/directory.png' width='20' height='20'> <span class=\"toggle\">$dir</span>";
    createDir($path.$dir."/");
    echo "</li>";
    }
     
    createDir($path);
    echo"<p align='center'><input type='submit' name='filedel' value='Delete'></p>
    </form>";
     
     
     
     
     
     
    ?>
     
    </div>
    <!-- End Menu -->
     
     
    <!-- Add jQuery From the Google AJAX Libraries -->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
     
    <!-- jQuery Color Plugin -->
    <script type="text/javascript" src="jquery.color.js"></script>
     
    <!-- Import The jQuery Script -->
    <script type="text/javascript" src="jMenu.js"></script>
     
    </body>
    </html>


    •  
      if(isset($_POST['filedel'])) {
       
       
                                 
      $id = $_POST[del];
      $count = count($id);
       
       
       
      for ($i=0; $i<$count; $i++){
       
       
      $files = $_POST['del'];
       
       
      echo"$files.$count";
      }
       
       
       
       
       
       
         
                  }

     

 

Link to comment
Share on other sites

Jes I know the jquery tree is working fine but i do't know how to make the checkbox delete the file that i check ..that is the problem !!! I can't get the name from the check box i get this "array.1 that is what I put to the echo statemant... to see would I get the name of the checked file ...

Link to comment
Share on other sites

[list]
[*][/list]<!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" dir="ltr" lang="en-US">
            <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            <title>jQuery Drop Down Menu</title>
            
            <!-- CSS For The Menu -->
            <link rel="stylesheet" href="stylee.css" />
            
            </head>
            <body>
            
            <!-- Menu Start -->
            <div id="jQ-menu">
            
            <?php
            error_reporting(0);
               $path = "store/".$diro."/";
            
               function createDir($path = '.')
               {   
                  if ($handle = opendir($path))
                  {
                     echo "<ul>";
                  
                     while (false !== ($file = readdir($handle)))
                     {
                        if (is_dir($path.$file) && $file != '.' && $file !='..')
                           printSubDir($file, $path, $queue);
                        else if ($file != '.' && $file !='..')
                           $queue[] = $file;
                     }
                     
                     printQueue($queue, $path);
                     echo "</ul>";
                  }
               }
               
               function printQueue($queue, $path)
               {
                  foreach ($queue as $file)
                  {
                     printFile($file, $path);
                  }
               }
               echo"<form action='osnovni_dokumenti.php?id=" . $data['ideo']. "' method='POST'>";
               function printFile($file, $path)
               {
                  
                  echo "<li><input type='checkbox' name='del[]' value='$file'/><a href=\"".$path.$file."\"><img src='slike_izgled/file.png'> $file</a></li>";
                              
               }
               
               function printSubDir($dir, $path)
               {
                  echo "<li><img src='slike_izgled/directory.png' width='20' height='20'> <span class=\"toggle\">$dir</span>";
                  createDir($path.$dir."/");
                  echo "</li>";
               }
               
               createDir($path);
               echo"<p align='center'><input type='submit' name='filedel' value='Delete'></p>
               </form>";
               
               
               
               
         
                     
            ?>
            
            </div>
            <!-- End Menu -->
            
            
            <!-- Add jQuery From the Google AJAX Libraries -->
            <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
            
            <!-- jQuery Color Plugin -->
            <script type="text/javascript" src="jquery.color.js"></script>
            
            <!-- Import The jQuery Script -->
            <script type="text/javascript" src="jMenu.js"></script>
            
            </body>
            </html>

<?php
    if(isset($_POST['filedel'])) {
                
                
                                        
                                  $id = $_POST[del];
                                  $count = count($id);
                                  
                                  
                                  
                                  for ($i=0; $i<$count; $i++){                     
                                                          
                                  
                                  $files = $_POST['del'];      
                         
                                              
                                  echo"$files.$count";
                                  echo '<pre>' . print_r($file, true) . '</pre>';
			  echo '<pre>' . print_r($files, true) . '</pre>';
			  echo $file[0] . ' - ' . $file[1] . '<br />';
			  echo $files[0] . ' - ' . $files[1] . '<br />';

                               }
             
             
             
                            
       
             
                
                }
?>
[list]
[*]
[/list]

Link to comment
Share on other sites

I'm not fully sure I understand what it is that's going wrong for you, but I've cleaned up your code and changed a few things, so give this a try.

 

<!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" dir="ltr" lang="en-US">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>jQuery Drop Down Menu</title>

        <!-- CSS For The Menu -->
        <link rel="stylesheet" href="stylee.css" />
        
        <!-- Add jQuery From the Google AJAX Libraries -->
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

        <!-- jQuery Color Plugin -->
        <script type="text/javascript" src="jquery.color.js"></script>

        <!-- Import The jQuery Script -->
        <script type="text/javascript" src="jMenu.js"></script>

    </head>
    <body>

        <!-- Menu Start -->
        <div id="jQ-menu">

            <?php
            error_reporting(0);
            $path = "store/" . $diro . "/";

            function createDir($path = '.') {
                $handle = opendir($path);
                if($handle) {
                    echo "<ul>";

                    while(false !== ($file = readdir($handle))) {
                        if(is_dir($path . $file) && $file !== '.' && $file !== '..') {
                            printSubDir($file, $path, $queue);
                        } elseif($file !== '.' && $file !== '..') {
                            $queue[] = $file;
                        }
                    }

                    printQueue($queue, $path);
                    echo "</ul>";
                }
            }

            function printQueue($queue, $path) {
                foreach($queue as $file) {
                    foreach($file as $FK => $FV) {
                        printFile($FV, $path);
                    }
                }
            }

            echo"<form action='osnovni_dokumenti.php?id=" . $data['ideo'] . "' method='POST'>";

            function printFile($file, $path) {

                echo "<li><input type='checkbox' name='del[]' value='$file'/><a href=\"" . $path . $file . "\"><img src='slike_izgled/file.png'> $file</a></li>";
            }

            function printSubDir($dir, $path) {
                echo "<li><img src='slike_izgled/directory.png' width='20' height='20'> <span class=\"toggle\">$dir</span>";
                createDir($path . $dir . "/");
                echo "</li>";
            }

            createDir($path);
            echo"<p align='center'><input type='submit' name='filedel' value='Delete'></p>
               </form>";
            ?>

        </div>
        <!-- End Menu -->
    </body>
</html>

<?php
if(isset($_POST['filedel'])) {



    $id = $_POST['del'];
    $count = count($id);



    for($i = 0; $i < $count; $i++) {


        $files = $_POST['del'];


        echo"$files.$count";
        echo '<pre>' . print_r($file, true) . '</pre>';
        echo '<pre>' . print_r($files, true) . '</pre>';
        echo $file[0] . ' - ' . $file[1] . '<br />';
        echo $files[0] . ' - ' . $files[1] . '<br />';
    }
}
?>

 

James.

Link to comment
Share on other sites

I'm not fully sure I understand what it is that's going wrong for you, but I've cleaned up your code and changed a few things, so give this a try.

 

<!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" dir="ltr" lang="en-US">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>jQuery Drop Down Menu</title>

        <!-- CSS For The Menu -->
        <link rel="stylesheet" href="stylee.css" />
        
        <!-- Add jQuery From the Google AJAX Libraries -->
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

        <!-- jQuery Color Plugin -->
        <script type="text/javascript" src="jquery.color.js"></script>

        <!-- Import The jQuery Script -->
        <script type="text/javascript" src="jMenu.js"></script>

    </head>
    <body>

        <!-- Menu Start -->
        <div id="jQ-menu">

            <?php
            error_reporting(0);
            $path = "store/" . $diro . "/";

            function createDir($path = '.') {
                $handle = opendir($path);
                if($handle) {
                    echo "<ul>";

                    while(false !== ($file = readdir($handle))) {
                        if(is_dir($path . $file) && $file !== '.' && $file !== '..') {
                            printSubDir($file, $path, $queue);
                        } elseif($file !== '.' && $file !== '..') {
                            $queue[] = $file;
                        }
                    }

                    printQueue($queue, $path);
                    echo "</ul>";
                }
            }

            function printQueue($queue, $path) {
                foreach($queue as $file) {
                    foreach($file as $FK => $FV) {
                        printFile($FV, $path);
                    }
                }
            }

            echo"<form action='osnovni_dokumenti.php?id=" . $data['ideo'] . "' method='POST'>";

            function printFile($file, $path) {

                echo "<li><input type='checkbox' name='del[]' value='$file'/><a href=\"" . $path . $file . "\"><img src='slike_izgled/file.png'> $file</a></li>";
            }

            function printSubDir($dir, $path) {
                echo "<li><img src='slike_izgled/directory.png' width='20' height='20'> <span class=\"toggle\">$dir</span>";
                createDir($path . $dir . "/");
                echo "</li>";
            }

            createDir($path);
            echo"<p align='center'><input type='submit' name='filedel' value='Delete'></p>
               </form>";
            ?>

        </div>
        <!-- End Menu -->
    </body>
</html>

<?php
if(isset($_POST['filedel'])) {



    $id = $_POST['del'];
    $count = count($id);



    for($i = 0; $i < $count; $i++) {


        $files = $_POST['del'];


        echo"$files.$count";
        echo '<pre>' . print_r($file, true) . '</pre>';
        echo '<pre>' . print_r($files, true) . '</pre>';
        echo $file[0] . ' - ' . $file[1] . '<br />';
        echo $files[0] . ' - ' . $files[1] . '<br />';
    }
}
?>

 

James.

OK I'l try to explain to you sou I'v got  directory tree and files in that directory's, by every file I have check box and on the end submit buton .

What I need is function that whill delete the file, " in this case the file is the $file variable", that I have mark in check box.Now when I click the submit button I get -> example down...

 

Array
(
    [0] => Dundo Maroje.txt
)

-
Dundo Maroje.txt - 

 

 

Now this file "Dundo Maroje.txt" must bee deleted from the directory ... How to doo that ? ONLY THE CHECKED FILE MUST BEE DELETED WHEN i SUBMIT THE FORM ... understand? Sory my english is litle por... Soo can you help ?

 

Link to comment
Share on other sites

<!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" dir="ltr" lang="en-US">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>jQuery Drop Down Menu</title>

        <!-- CSS For The Menu -->
        <link rel="stylesheet" href="stylee.css" />
        
        <!-- Add jQuery From the Google AJAX Libraries -->
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

        <!-- jQuery Color Plugin -->
        <script type="text/javascript" src="jquery.color.js"></script>

        <!-- Import The jQuery Script -->
        <script type="text/javascript" src="jMenu.js"></script>

    </head>
    <body>

        <!-- Menu Start -->
        <div id="jQ-menu">

            <?php
            error_reporting(0);
            $path = "store/" . $diro . "/";

            function createDir($path = '.') {
                $handle = opendir($path);
                if($handle) {
                    echo "<ul>";

                    while(false !== ($file = readdir($handle))) {
                        if(is_dir($path . $file) && $file !== '.' && $file !== '..') {
                            printSubDir($file, $path, $queue);
                        } elseif($file !== '.' && $file !== '..') {
                            $queue[] = $file;
                        }
                    }

                    printQueue($queue, $path);
                    echo "</ul>";
                }
            }

            function printQueue($queue, $path) {
                foreach($queue as $file) {
                    foreach($file as $FK => $FV) {
                        printFile($FV, $path);
                    }
                }
            }

            echo"<form action='osnovni_dokumenti.php?id=" . $data['ideo'] . "' method='POST'>";

            function printFile($file, $path) {

                echo "<li><input type='checkbox' name='del[]' value='$file'/><a href=\"" . $path . $file . "\"><img src='slike_izgled/file.png'> $file</a></li>";
            }

            function printSubDir($dir, $path) {
                echo "<li><img src='slike_izgled/directory.png' width='20' height='20'> <span class=\"toggle\">$dir</span>";
                createDir($path . $dir . "/");
                echo "</li>";
            }

            createDir($path);
            echo"<p align='center'><input type='submit' name='filedel' value='Delete'></p>
               </form>";
            ?>

        </div>
        <!-- End Menu -->
    </body>
</html>

<?php
if(isset($_POST['filedel'])) {

    $id = $_POST['del'];
    $count = count($id);

    for($i = 0; $i < $count; $i++) {

        $files = $_POST['del'];

        echo"$files.$count";
        echo '<pre>' . print_r($file, true) . '</pre>';
        echo '<pre>' . print_r($files, true) . '</pre>';
        echo $file[0] . ' - ' . $file[1] . '<br />';
        echo $files[0] . ' - ' . $files[1] . '<br />';

        if(unlink('store' . $file[$i])) {
             echo 'File ' . $file[$i] . ' deleted.';
        } else {
             echo 'Failed to delete ' . $file[$i];
        }
    }
}
?>

 

Try that.

 

James.

Link to comment
Share on other sites

<!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" dir="ltr" lang="en-US">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>jQuery Drop Down Menu</title>

        <!-- CSS For The Menu -->
        <link rel="stylesheet" href="stylee.css" />
        
        <!-- Add jQuery From the Google AJAX Libraries -->
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

        <!-- jQuery Color Plugin -->
        <script type="text/javascript" src="jquery.color.js"></script>

        <!-- Import The jQuery Script -->
        <script type="text/javascript" src="jMenu.js"></script>

    </head>
    <body>

        <!-- Menu Start -->
        <div id="jQ-menu">

            <?php
            error_reporting(0);
            $path = "store/" . $diro . "/";

            function createDir($path = '.') {
                $handle = opendir($path);
                if($handle) {
                    echo "<ul>";

                    while(false !== ($file = readdir($handle))) {
                        if(is_dir($path . $file) && $file !== '.' && $file !== '..') {
                            printSubDir($file, $path, $queue);
                        } elseif($file !== '.' && $file !== '..') {
                            $queue[] = $file;
                        }
                    }

                    printQueue($queue, $path);
                    echo "</ul>";
                }
            }

            function printQueue($queue, $path) {
                foreach($queue as $file) {
                    foreach($file as $FK => $FV) {
                        printFile($FV, $path);
                    }
                }
            }

            echo"<form action='osnovni_dokumenti.php?id=" . $data['ideo'] . "' method='POST'>";

            function printFile($file, $path) {

                echo "<li><input type='checkbox' name='del[]' value='$file'/><a href=\"" . $path . $file . "\"><img src='slike_izgled/file.png'> $file</a></li>";
            }

            function printSubDir($dir, $path) {
                echo "<li><img src='slike_izgled/directory.png' width='20' height='20'> <span class=\"toggle\">$dir</span>";
                createDir($path . $dir . "/");
                echo "</li>";
            }

            createDir($path);
            echo"<p align='center'><input type='submit' name='filedel' value='Delete'></p>
               </form>";
            ?>

        </div>
        <!-- End Menu -->
    </body>
</html>

<?php
if(isset($_POST['filedel'])) {

    $id = $_POST['del'];
    $count = count($id);

    for($i = 0; $i < $count; $i++) {

        $files = $_POST['del'];

        echo"$files.$count";
        echo '<pre>' . print_r($file, true) . '</pre>';
        echo '<pre>' . print_r($files, true) . '</pre>';
        echo $file[0] . ' - ' . $file[1] . '<br />';
        echo $files[0] . ' - ' . $files[1] . '<br />';

        if(unlink('store' . $file[$i])) {
             echo 'File ' . $file[$i] . ' deleted.';
        } else {
             echo 'Failed to delete ' . $file[$i];
        }
    }
}
?>

 

Try that.

 

James.

I hav tried but it get back this :

 

 

Array
(
    [0] => popis.txt
)

-
popis.txt -
Failed to delete 

 

Ther is no "  $file[$i];" in the Faild to delete so ther is no varible in the unlink ? or???? Why?

Link to comment
Share on other sites

Neven, the code you have is very poorly composed. I have written this for you to get you back on track but you cannot expect people to write thee entire script for you because your code is messy. Anyway, I hope this helps.

 

<?php

/**
* @author James Pollard
*/

class createTree {

    private $FilePath;
    private $TreeData;

    public function __construct() {
        $this->FilePath = 'YOUR DIRECTORY HERE! DO NOT PUT A SLASH AT THE END OF IT!';
        $this->GenerateTreeData();
        return true;
    }

    public function deleteFile($FileID) {
        if(is_file($FileID)) {
            if(unlink($FileID)) {
                return 'File ' . $FileID . ' has been deleted.';
            } else {
                return 'Failed to delete file ' . $FileID . '.';
            }
        } else {
            return 'File ' . $FileID . ' does not exist.';
        }
    }

    private function GenerateTreeData() {
        $ParentFolder = scandir($this->FilePath . '/');

        $this->TreeData = array();
        $Folders = array();

        foreach($ParentFolder as $PFK => $PFV) {
            if($PFV !== '.' && $PFV !== '..') {
                if(is_file($this->FilePath . '/' . $PFV)) {
                    $this->TreeData[$this->FilePath] = $PFV;
                } elseif(is_dir($this->FilePath . '/' . $PFV)) {
                    $this->TreeData[$this->FilePath][$PFV] = array();
                    $Folders[] = $PFV;
                }
            }
        }
        
        $this->ScanFolders($Folders);
        
        return $this->TreeData;
    }

    private function ScanFolders($Folders) {
        foreach($Folders as $FK => $FV) {
            $FolderData = scandir($this->FilePath . '/' . $FV . '/');

            foreach($FolderData as $FDK => $FDV) {
                if($FDV !== '.' && $FDV !== '..') {
                    if(is_file($this->FilePath . '/' . $FV . '/' . $FDV)) {
                        if(strpos($FV, '/') !== false) {
                            $TP = explode('/', $FV);
                            $this->TreeData[$this->FilePath][$TP[0]][$TP[1]][] = $FDV;
                        } else {
                            $this->TreeData[$this->FilePath][$FV][] = $FDV;
                        }
                    } elseif(is_dir($this->FilePath . '/' . $FV . '/' . $FDV)) {
                        $this->TreeData[$this->FilePath][$FV][$FDV] = array();
                        $Folders[] = $FV . '/' . $FDV;
                    }
                }
            }

            unset($Folders[$FK]);
        }

        if(count($Folders) === 0) {
            return true;
        } else {
            $this->ScanFolders($Folders);
        }
    }
    
    private function CreateTreeFolder($Folder, $ParentFolder) {
        if(is_string($Folder)) {
            return '<ul><li><img src="slike_izgled/directory.png" width="20" height="20"> <span class="toggle">' . $Folder . '</span>';
        } elseif(is_array($Folder)) {
            $Return = '';
            
            foreach($Folder as $TFK => $TFV) {
                if(is_array($TFV)) {
                    $Return .= $this->CreateTreeFolder($TFK, $ParentFolder);
                    $Return .= $this->CreateTreeFile($TFV, $ParentFolder . '/' . $TFK);
                    $Return .= '</li></ul>';
                } else {
                    $Return .= $this->CreateTreeFile($TFV, $ParentFolder);
                }
            }
            
            return $Return;
        } else {
            return '';
        }
    }
    
    private function CreateTreeFile($File, $Folder) {
        if(is_string($File)) {
            return '<li><input type="checkbox" name="delfile[]" value="' . $this->FilePath . '/' . $Folder . '/' . $File . '"/><a href="' . $this->FilePath . '/' . $Folder . '/' . $File . '"><img src="slike_izgled/file.png"> ' . $File . '</a></li>';
        } elseif(is_array($File)) {
            $Return = '';
            
            foreach($File as $TFK => $TFV) {
                $Return .= '<li><input type="checkbox" name="delfile[]" value="' . $this->FilePath . '/' . $Folder . '/' . $TFV . '"/><a href="' . $this->FilePath . '/' . $Folder . '/' . $TFV . '"><img src="slike_izgled/file.png"> ' . $TFV . '</a></li>';
            }
            
            return $Return;
        }
    }
    
    public function CreateTree() {
        $Return = '<ul>';
        $Return .= $this->CreateTreeFolder($this->FilePath, $this->FilePath);
        
        foreach($this->TreeData[$this->FilePath] as $TK => $TV) {
            if(is_array($TV)) {
                $Return .= '<ul><li><img src="slike_izgled/directory.png" width="20" height="20"> <span class="toggle">' . $TK . '</span>';
                $Return .= $this->CreateTreeFolder($TV, $TK);
                $Return .= '</li></ul>';
            } else {
                $Return .= $this->CreateTreeFile($TV, $TK);
            }
        }
        
        $Return .= '</ul>';
        
        return $Return;
    }

    public function __destruct() {
        return true;
    }

}

$CT = new createTree;

if(isset($_POST['filedel'])) {
    $Response = '';
    if(isset($_POST['delfile']) && !empty($_POST['delfile']) && is_array($_POST['delfile']) && count($_POST['delfile']) > 0) {
        
        foreach($_POST['delfile'] as $DFK => $DFV) {
            $Response .= $CT->deleteFile($DFV) . '<br />';
        }
        
    } else {
        $Response = 'Please select a file to delete.';
    }
}
?>
<!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" dir="ltr" lang="en-US">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>jQuery Drop Down Menu</title>

        <link rel="stylesheet" href="stylee.css" />
        
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
        <script type="text/javascript" src="jquery.color.js"></script>
        <script type="text/javascript" src="jMenu.js"></script>

    </head>
    <body>
        <div id="jQ-menu">
            <b><?php echo $Response; ?></b>
            <!--- osnovni_dokumenti.php?id=</?php echo $data['ideo']; ?> --->
            <form action="#" method="post">
                
                <?php
                    echo $CT->CreateTree();
                ?>
                
                <p align='center'>
                    <input type="submit" name="filedel" value="Delete" />
                </p>
            </form>
        </div>
    </body>
</html>

 

James.

Link to comment
Share on other sites

Neven, the code you have is very poorly composed. I have written this for you to get you back on track but you cannot expect people to write thee entire script for you because your code is messy. Anyway, I hope this helps.

 

<?php

/**
* @author James Pollard
*/

class createTree {

    private $FilePath;
    private $TreeData;

    public function __construct() {
        $this->FilePath = 'YOUR DIRECTORY HERE! DO NOT PUT A SLASH AT THE END OF IT!';
        $this->GenerateTreeData();
        return true;
    }

    public function deleteFile($FileID) {
        if(is_file($FileID)) {
            if(unlink($FileID)) {
                return 'File ' . $FileID . ' has been deleted.';
            } else {
                return 'Failed to delete file ' . $FileID . '.';
            }
        } else {
            return 'File ' . $FileID . ' does not exist.';
        }
    }

    private function GenerateTreeData() {
        $ParentFolder = scandir($this->FilePath . '/');

        $this->TreeData = array();
        $Folders = array();

        foreach($ParentFolder as $PFK => $PFV) {
            if($PFV !== '.' && $PFV !== '..') {
                if(is_file($this->FilePath . '/' . $PFV)) {
                    $this->TreeData[$this->FilePath] = $PFV;
                } elseif(is_dir($this->FilePath . '/' . $PFV)) {
                    $this->TreeData[$this->FilePath][$PFV] = array();
                    $Folders[] = $PFV;
                }
            }
        }
        
        $this->ScanFolders($Folders);
        
        return $this->TreeData;
    }

    private function ScanFolders($Folders) {
        foreach($Folders as $FK => $FV) {
            $FolderData = scandir($this->FilePath . '/' . $FV . '/');

            foreach($FolderData as $FDK => $FDV) {
                if($FDV !== '.' && $FDV !== '..') {
                    if(is_file($this->FilePath . '/' . $FV . '/' . $FDV)) {
                        if(strpos($FV, '/') !== false) {
                            $TP = explode('/', $FV);
                            $this->TreeData[$this->FilePath][$TP[0]][$TP[1]][] = $FDV;
                        } else {
                            $this->TreeData[$this->FilePath][$FV][] = $FDV;
                        }
                    } elseif(is_dir($this->FilePath . '/' . $FV . '/' . $FDV)) {
                        $this->TreeData[$this->FilePath][$FV][$FDV] = array();
                        $Folders[] = $FV . '/' . $FDV;
                    }
                }
            }

            unset($Folders[$FK]);
        }

        if(count($Folders) === 0) {
            return true;
        } else {
            $this->ScanFolders($Folders);
        }
    }
    
    private function CreateTreeFolder($Folder, $ParentFolder) {
        if(is_string($Folder)) {
            return '<ul><li><img src="slike_izgled/directory.png" width="20" height="20"> <span class="toggle">' . $Folder . '</span>';
        } elseif(is_array($Folder)) {
            $Return = '';
            
            foreach($Folder as $TFK => $TFV) {
                if(is_array($TFV)) {
                    $Return .= $this->CreateTreeFolder($TFK, $ParentFolder);
                    $Return .= $this->CreateTreeFile($TFV, $ParentFolder . '/' . $TFK);
                    $Return .= '</li></ul>';
                } else {
                    $Return .= $this->CreateTreeFile($TFV, $ParentFolder);
                }
            }
            
            return $Return;
        } else {
            return '';
        }
    }
    
    private function CreateTreeFile($File, $Folder) {
        if(is_string($File)) {
            return '<li><input type="checkbox" name="delfile[]" value="' . $this->FilePath . '/' . $Folder . '/' . $File . '"/><a href="' . $this->FilePath . '/' . $Folder . '/' . $File . '"><img src="slike_izgled/file.png"> ' . $File . '</a></li>';
        } elseif(is_array($File)) {
            $Return = '';
            
            foreach($File as $TFK => $TFV) {
                $Return .= '<li><input type="checkbox" name="delfile[]" value="' . $this->FilePath . '/' . $Folder . '/' . $TFV . '"/><a href="' . $this->FilePath . '/' . $Folder . '/' . $TFV . '"><img src="slike_izgled/file.png"> ' . $TFV . '</a></li>';
            }
            
            return $Return;
        }
    }
    
    public function CreateTree() {
        $Return = '<ul>';
        $Return .= $this->CreateTreeFolder($this->FilePath, $this->FilePath);
        
        foreach($this->TreeData[$this->FilePath] as $TK => $TV) {
            if(is_array($TV)) {
                $Return .= '<ul><li><img src="slike_izgled/directory.png" width="20" height="20"> <span class="toggle">' . $TK . '</span>';
                $Return .= $this->CreateTreeFolder($TV, $TK);
                $Return .= '</li></ul>';
            } else {
                $Return .= $this->CreateTreeFile($TV, $TK);
            }
        }
        
        $Return .= '</ul>';
        
        return $Return;
    }

    public function __destruct() {
        return true;
    }

}

$CT = new createTree;

if(isset($_POST['filedel'])) {
    $Response = '';
    if(isset($_POST['delfile']) && !empty($_POST['delfile']) && is_array($_POST['delfile']) && count($_POST['delfile']) > 0) {
        
        foreach($_POST['delfile'] as $DFK => $DFV) {
            $Response .= $CT->deleteFile($DFV) . '<br />';
        }
        
    } else {
        $Response = 'Please select a file to delete.';
    }
}
?>
<!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" dir="ltr" lang="en-US">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>jQuery Drop Down Menu</title>

        <link rel="stylesheet" href="stylee.css" />
        
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
        <script type="text/javascript" src="jquery.color.js"></script>
        <script type="text/javascript" src="jMenu.js"></script>

    </head>
    <body>
        <div id="jQ-menu">
            <b><?php echo $Response; ?></b>
            <!--- osnovni_dokumenti.php?id=</?php echo $data['ideo']; ?> --->
            <form action="#" method="post">
                
                <?php
                    echo $CT->CreateTree();
                ?>
                
                <p align='center'>
                    <input type="submit" name="filedel" value="Delete" />
                </p>
            </form>
        </div>
    </body>
</html>

 

James.

 

 

But ther is a litl problem vith the construction of the directory tree ....It must look like this ->The first atachment and the second is how it loks like now... Can you do this for me ? :)

 

[attachment deleted by admin]

Link to comment
Share on other sites

My pleasure, anytime :-)! Hope it helps Neven.

 

Replace
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

With
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>

 

Happy coding!

 

James.

 

P.S; Remember to make this topic as SOLVED :-).

Link to comment
Share on other sites

My pleasure, anytime :-)! Hope it helps Neven.

 

Replace
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

With
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>

 

Happy coding!

 

James.

 

P.S; Remember to make this topic as SOLVED :-).

 

 

No i MENT the directory tree is not opening the files and dir like my firs one .... Understand ? Maybe not .... in the directorys I need that from one directory come out the other three directory's 3 like on the picture ... like this  frst dir is the FIRST DIR IS-"ID" FROM THAT directory it comes out the other tree like on the picture -> osnovni dokumenti, ostali dokumenti, & pictures  U know what I meen ?

Link to comment
Share on other sites

Look all I have in this php code is corect AND I need it yust like that .........The onnly thing I NEED IS THE DELETE FUNCION IN THIS SCRIPT ....

The script that you make is ok but it is not the sam structure..... sou this is the code that I vont to use ....Sou directory tree must have the same hierarhy as it is in this script below .....ALL I NEED IS THE CHECK BOX UNLINK FUNKCION ...THAT CAN DELETE FILES IN DIRECTORY'S

And all files must bee in the directory's ....Sou James if you woul bee so kind :)  Or whou ever have the answer ,...please help this is first time that i have come up on that hard ploblem .... THANKS FORWARD :)

 

 

 if(isset($_POST['pregled']))
	     {
		     
		     
		     
		   //start of list
		     
		     $id = $_GET['id'];
			 $q = "SELECT * FROM albums WHERE $id = ideo";
			 $results = mysql_query($q);
			 $data = mysql_fetch_array($results);
			 $diro = $data['dosjeid'];
                                 $id = $data['ideo'];
                 
		  
                
              
		   //open the dir
		echo"<table border='2' cellpadding='5' width='630'>
		<tr>
		<td width='300'>";   
		?>
		<!--start of dir tree!-->

	<!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" dir="ltr" lang="en-US"> 
			<head> 
			<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
			<title>jQuery Drop Down Menu</title> 

			<!-- CSS For The Menu --> 
			<link rel="stylesheet" href="stylee.css" /> 

			</head> 
			<body> 

			<!-- Menu Start --> 
			<div id="jQ-menu"> 

			<?php
			error_reporting(0);
				$path = "store/".$diro;  ///////////I need this variable !!!

				function createDir($path = '.')
				{	
					if ($handle = opendir($path)) 
					{
						echo "<ul>";

						while (false !== ($file = readdir($handle))) 
						{
							if (is_dir($path.$file) && $file != '.' && $file !='..')
								printSubDir($file, $path, $queue);
							else if ($file != '.' && $file !='..')
								$queue[] = $file;
						}

						printQueue($queue, $path);
						echo "</ul>";
					}
				}

				function printQueue($queue, $path)
				{
					foreach ($queue as $file) 
					{
						printFile($file, $path);
					} 
				}
				echo"<form action='osnovni_dokumenti.php?id=" . $data['ideo']. "' method='POST'>";
				function printFile($file, $path)
				{

echo "<li><input type='checkbox' name='del[]' value='$file'/><a href=\"".$path.$file."\"><img src='slike_izgled/file.png'> $file</a></li>";

				}

				function printSubDir($dir, $path)
				{
					echo "<li><img src='slike_izgled/directory.png' width='20' height='20'> <span class=\"toggle\">$dir</span>";
					createDir($path.$dir."/");
					echo "</li>";
				}

				createDir($path);
				echo"<p align='center'><input type='submit' name='filedel' value='Delete'></p>
				</form>";






			?>

			</div> 
			<!-- End Menu --> 


			<!-- Add jQuery From the Google AJAX Libraries --> 
			<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>

			<!-- jQuery Color Plugin --> 
			<script type="text/javascript" src="jquery.color.js"></script> 

			<!-- Import The jQuery Script --> 
			<script type="text/javascript" src="jMenu.js"></script> 

			</body>

			</html> 


		<!--end of tree!-->
		<?


//Now this is wher the submit button need to delete the file...


		if(isset($_POST['filedel'])) {



/////////////////////////////////////////////////Missing code!!!!!!!!!!!!!!!!!!!!!!!!			


                    
		}        
            






The picture below shows how it should look like....

 

Directory_tree.jpg

 

 

 

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

<?php

/**
* @author James Pollard
*/

if(isset($_POST['pregled'])) {

    $id = $_GET['id'];
    $q = "SELECT * FROM `albums` WHERE `" . $id . "` = 'ideo'";
    $results = mysql_query($q);
    $data = mysql_fetch_array($results);
    $diro = $data['dosjeid'];
    $id = $data['ideo'];
    
    class createTree {

        private $FilePath;
        private $TreeData;

        public function __construct($DirInput) {
            $this->FilePath = $DirInput;
            $this->GenerateTreeData();
            return true;
        }

        public function deleteFile($FileID) {
            if(is_file($FileID)) {
                if(unlink($FileID)) {
                    return 'File ' . $FileID . ' has been deleted.';
                } else {
                    return 'Failed to delete file ' . $FileID . '.';
                }
            } else {
                return 'File ' . $FileID . ' does not exist.';
            }
        }

        private function GenerateTreeData() {
            $ParentFolder = scandir($this->FilePath . '/');

            $this->TreeData = array();
            $Folders = array();

            foreach($ParentFolder as $PFK => $PFV) {
                if($PFV !== '.' && $PFV !== '..') {
                    if(is_file($this->FilePath . '/' . $PFV)) {
                        $this->TreeData[$this->FilePath] = $PFV;
                    } elseif(is_dir($this->FilePath . '/' . $PFV)) {
                        $this->TreeData[$this->FilePath][$PFV] = array();
                        $Folders[] = $PFV;
                    }
                }
            }

            $this->ScanFolders($Folders);

            return $this->TreeData;
        }

        private function ScanFolders($Folders) {
            foreach($Folders as $FK => $FV) {
                $FolderData = scandir($this->FilePath . '/' . $FV . '/');

                foreach($FolderData as $FDK => $FDV) {
                    if($FDV !== '.' && $FDV !== '..') {
                        if(is_file($this->FilePath . '/' . $FV . '/' . $FDV)) {
                            if(strpos($FV, '/') !== false) {
                                $TP = explode('/', $FV);
                                $this->TreeData[$this->FilePath][$TP[0]][$TP[1]][] = $FDV;
                            } else {
                                $this->TreeData[$this->FilePath][$FV][] = $FDV;
                            }
                        } elseif(is_dir($this->FilePath . '/' . $FV . '/' . $FDV)) {
                            $this->TreeData[$this->FilePath][$FV][$FDV] = array();
                            $Folders[] = $FV . '/' . $FDV;
                        }
                    }
                }

                unset($Folders[$FK]);
            }

            if(count($Folders) === 0) {
                return true;
            } else {
                $this->ScanFolders($Folders);
            }
        }

        private function CreateTreeFolder($Folder, $ParentFolder) {
            if(is_string($Folder)) {
                return '<ul><li><img src="slike_izgled/directory.png" width="20" height="20"> <span class="toggle">' . $Folder . '</span>';
            } elseif(is_array($Folder)) {
                $Return = '';

                foreach($Folder as $TFK => $TFV) {
                    if(is_array($TFV)) {
                        $Return .= $this->CreateTreeFolder($TFK, $ParentFolder);
                        $Return .= $this->CreateTreeFile($TFV, $ParentFolder . '/' . $TFK);
                        $Return .= '</li></ul>';
                    } else {
                        $Return .= $this->CreateTreeFile($TFV, $ParentFolder);
                    }
                }

                return $Return;
            } else {
                return '';
            }
        }

        private function CreateTreeFile($File, $Folder) {
            if(is_string($File)) {
                return '<li><input type="checkbox" name="delfile[]" value="' . $this->FilePath . '/' . $Folder . '/' . $File . '"/><a href="' . $this->FilePath . '/' . $Folder . '/' . $File . '"><img src="slike_izgled/file.png"> ' . $File . '</a></li>';
            } elseif(is_array($File)) {
                $Return = '';

                foreach($File as $TFK => $TFV) {
                    $Return .= '<li><input type="checkbox" name="delfile[]" value="' . $this->FilePath . '/' . $Folder . '/' . $TFV . '"/><a href="' . $this->FilePath . '/' . $Folder . '/' . $TFV . '"><img src="slike_izgled/file.png"> ' . $TFV . '</a></li>';
                }

                return $Return;
            }
        }

        public function CreateTree() {
            $Return = '<ul>';
            $Return .= $this->CreateTreeFolder($this->FilePath, $this->FilePath);

            foreach($this->TreeData[$this->FilePath] as $TK => $TV) {
                if(is_array($TV)) {
                    $Return .= '<ul><li><img src="slike_izgled/directory.png" width="20" height="20"> <span class="toggle">' . $TK . '</span>';
                    $Return .= $this->CreateTreeFolder($TV, $TK);
                    $Return .= '</li></ul>';
                } else {
                    $Return .= $this->CreateTreeFile($TV, $TK);
                }
            }

            $Return .= '</ul>';

            return $Return;
        }

        public function __destruct() {
            return true;
        }

    }

    $CT = new createTree($diro);

    if(isset($_POST['filedel'])) {
        $Response = '';
        if(isset($_POST['delfile']) && !empty($_POST['delfile']) && is_array($_POST['delfile']) && count($_POST['delfile']) > 0) {

            foreach($_POST['delfile'] as $DFK => $DFV) {
                $Response .= $CT->deleteFile($DFV) . '<br />';
            }
        } else {
            $Response = 'Please select a file to delete.';
        }
    }
    ?>
    <!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" dir="ltr" lang="en-US">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            <title>jQuery Drop Down Menu</title>

            <link rel="stylesheet" href="stylee.css" />

            <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
            <script type="text/javascript" src="jquery.color.js"></script>
            <script type="text/javascript" src="jMenu.js"></script>

        </head>
        <body>
            <div id="jQ-menu">
                <b><?php echo $Response; ?></b>
                <!--- osnovni_dokumenti.php?id=</?php echo $data['ideo']; ?> --->
                <form action="#" method="post">

    <?php
    echo $CT->CreateTree();
    ?>

                <p align='center'>
                    <input type="submit" name="filedel" value="Delete" />
                </p>
            </form>
        </div>
    </body>
</html>
<?php } ?>

 

James.

Link to comment
Share on other sites

<?php

/**
* @author James Pollard
*/

if(isset($_POST['pregled'])) {

    $id = $_GET['id'];
    $q = "SELECT * FROM `albums` WHERE `" . $id . "` = 'ideo'";
    $results = mysql_query($q);
    $data = mysql_fetch_array($results);
    $diro = $data['dosjeid'];
    $id = $data['ideo'];
    
    class createTree {

        private $FilePath;
        private $TreeData;

        public function __construct($DirInput) {
            $this->FilePath = $DirInput;
            $this->GenerateTreeData();
            return true;
        }

        public function deleteFile($FileID) {
            if(is_file($FileID)) {
                if(unlink($FileID)) {
                    return 'File ' . $FileID . ' has been deleted.';
                } else {
                    return 'Failed to delete file ' . $FileID . '.';
                }
            } else {
                return 'File ' . $FileID . ' does not exist.';
            }
        }

        private function GenerateTreeData() {
            $ParentFolder = scandir($this->FilePath . '/');

            $this->TreeData = array();
            $Folders = array();

            foreach($ParentFolder as $PFK => $PFV) {
                if($PFV !== '.' && $PFV !== '..') {
                    if(is_file($this->FilePath . '/' . $PFV)) {
                        $this->TreeData[$this->FilePath] = $PFV;
                    } elseif(is_dir($this->FilePath . '/' . $PFV)) {
                        $this->TreeData[$this->FilePath][$PFV] = array();
                        $Folders[] = $PFV;
                    }
                }
            }

            $this->ScanFolders($Folders);

            return $this->TreeData;
        }

        private function ScanFolders($Folders) {
            foreach($Folders as $FK => $FV) {
                $FolderData = scandir($this->FilePath . '/' . $FV . '/');

                foreach($FolderData as $FDK => $FDV) {
                    if($FDV !== '.' && $FDV !== '..') {
                        if(is_file($this->FilePath . '/' . $FV . '/' . $FDV)) {
                            if(strpos($FV, '/') !== false) {
                                $TP = explode('/', $FV);
                                $this->TreeData[$this->FilePath][$TP[0]][$TP[1]][] = $FDV;
                            } else {
                                $this->TreeData[$this->FilePath][$FV][] = $FDV;
                            }
                        } elseif(is_dir($this->FilePath . '/' . $FV . '/' . $FDV)) {
                            $this->TreeData[$this->FilePath][$FV][$FDV] = array();
                            $Folders[] = $FV . '/' . $FDV;
                        }
                    }
                }

                unset($Folders[$FK]);
            }

            if(count($Folders) === 0) {
                return true;
            } else {
                $this->ScanFolders($Folders);
            }
        }

        private function CreateTreeFolder($Folder, $ParentFolder) {
            if(is_string($Folder)) {
                return '<ul><li><img src="slike_izgled/directory.png" width="20" height="20"> <span class="toggle">' . $Folder . '</span>';
            } elseif(is_array($Folder)) {
                $Return = '';

                foreach($Folder as $TFK => $TFV) {
                    if(is_array($TFV)) {
                        $Return .= $this->CreateTreeFolder($TFK, $ParentFolder);
                        $Return .= $this->CreateTreeFile($TFV, $ParentFolder . '/' . $TFK);
                        $Return .= '</li></ul>';
                    } else {
                        $Return .= $this->CreateTreeFile($TFV, $ParentFolder);
                    }
                }

                return $Return;
            } else {
                return '';
            }
        }

        private function CreateTreeFile($File, $Folder) {
            if(is_string($File)) {
                return '<li><input type="checkbox" name="delfile[]" value="' . $this->FilePath . '/' . $Folder . '/' . $File . '"/><a href="' . $this->FilePath . '/' . $Folder . '/' . $File . '"><img src="slike_izgled/file.png"> ' . $File . '</a></li>';
            } elseif(is_array($File)) {
                $Return = '';

                foreach($File as $TFK => $TFV) {
                    $Return .= '<li><input type="checkbox" name="delfile[]" value="' . $this->FilePath . '/' . $Folder . '/' . $TFV . '"/><a href="' . $this->FilePath . '/' . $Folder . '/' . $TFV . '"><img src="slike_izgled/file.png"> ' . $TFV . '</a></li>';
                }

                return $Return;
            }
        }

        public function CreateTree() {
            $Return = '<ul>';
            $Return .= $this->CreateTreeFolder($this->FilePath, $this->FilePath);

            foreach($this->TreeData[$this->FilePath] as $TK => $TV) {
                if(is_array($TV)) {
                    $Return .= '<ul><li><img src="slike_izgled/directory.png" width="20" height="20"> <span class="toggle">' . $TK . '</span>';
                    $Return .= $this->CreateTreeFolder($TV, $TK);
                    $Return .= '</li></ul>';
                } else {
                    $Return .= $this->CreateTreeFile($TV, $TK);
                }
            }

            $Return .= '</ul>';

            return $Return;
        }

        public function __destruct() {
            return true;
        }

    }

    $CT = new createTree($diro);

    if(isset($_POST['filedel'])) {
        $Response = '';
        if(isset($_POST['delfile']) && !empty($_POST['delfile']) && is_array($_POST['delfile']) && count($_POST['delfile']) > 0) {

            foreach($_POST['delfile'] as $DFK => $DFV) {
                $Response .= $CT->deleteFile($DFV) . '<br />';
            }
        } else {
            $Response = 'Please select a file to delete.';
        }
    }
    ?>
    <!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" dir="ltr" lang="en-US">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            <title>jQuery Drop Down Menu</title>

            <link rel="stylesheet" href="stylee.css" />

            <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
            <script type="text/javascript" src="jquery.color.js"></script>
            <script type="text/javascript" src="jMenu.js"></script>

        </head>
        <body>
            <div id="jQ-menu">
                <b><?php echo $Response; ?></b>
                <!--- osnovni_dokumenti.php?id=</?php echo $data['ideo']; ?> --->
                <form action="#" method="post">

    <?php
    echo $CT->CreateTree();
    ?>

                <p align='center'>
                    <input type="submit" name="filedel" value="Delete" />
                </p>
            </form>
        </div>
    </body>
</html>
<?php } ?>

 

James.

 

:) DANKE !

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.