Jump to content

paginate this?


blueman378

Recommended Posts

hi guys well heres the code im using:

<?php
echo "<div class=\"details\"><form method=\"post\" action=\"{$_SERVER['PHP_SELF']}?action=avatar\">";
echo "<select name=\"cat\">";
$dir = "avatars/";
if ($handle = opendir($dir)) {
   if ($handle != "." && $handle != "..")
            {
    while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..")
            { ?>
           <option <?php if($file == $_POST[cat]){?>selected = "selected" <?php } ?> value="<?php echo $file; ?>"><?php echo $file; ?></option>
          <?php }
}
        }
}

    closedir($handle);
    echo "</select><input type=\"submit\" value=\"Load\" class=\"button\"></form></div>";

    if (!isset($_POST['cat']))
{ 

echo "Please select an avatar category";
}
else
{
echo "<table width=\"100%\" cellspacing=\"15%\">";
echo "<tr>";
$dir2 = "avatars/{$_POST[cat]}";
// Open a known directory, and proceed to read its contents
    if ($dh = opendir($dir2)) {
    $i= "1";
        while (($file = readdir($dh)) !== false) {
        if ($file != "." && $file != "..")
            {
            if ($i == "6") {echo "</tr><tr>"; $i = "1";}
        echo "<td><img border=\"1\" src=\"{$dir2}/{$file}\"></td>";
            $i++;
                }}
        closedir($dh);
   echo "</tr></table>";
         }
}
        ?>

 

the output is http://www.test.webspirited.com/webspirited/forum/?action=avatar

 

which works fine, but what im wanting is a way to paginate the images?

 

any ideas?

Link to comment
https://forums.phpfreaks.com/topic/97778-paginate-this/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.