Jump to content

Jf88

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Jf88's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I am a complete beginner in PHP. Now I want to make a photo album for my website. I currently have made an index.php with 3 includes to other php pages: toonalbums.php (translation: showalbums.php) This page I use to make an list of all the photo albums that are available in a directory of my choice. The code in this page also needs to generate hyperlinks so I can watch all the photo's inside the specific albums. toonalbuminhoud.php (translation: showalbumcontent.php) This page I use so all the photo's will be visible in thumbnails. The thumbnails need to be hyperlinks so a bigger version of the photo's can be seen. toonfoto.php (translation: showfoto.php) This page I use to show the foto in his original size. The code I currently use is: toonalbums.php <?php $mapnaam = 'albums/'; echo '<ul>'; if ($handle = opendir($mapnaam)) { while (false !== ($albumnaam = readdir($handle))) { echo '<li><a href="?album=' . $_GET['album'] . '"></a></li>'; } closedir($handle); } echo '</ul>'; ?> toonalbuminhoud.php: <?php if(isset($_GET['album'])) { $albumnaam = $_GET['album']; $mapnaam = 'albums/' . $albumnaam; echo '<ul>' ; if ($handle = opendir($albumnaam)) { while (false !== ($fotonaam = readdir($handle))) { echo '<li><a href="?album=' . $_GET['album'] . '$foto=' . $_GET['foto'] . '"> <img class="thumbnail" src="' . $mapnaam . '/' . $fotonaam . '" alt="' . $fotonaam . '"/> </a></li>'; } closedir($handle); } echo '</ul>'; } ?> toonfoto.php: <?php if(isset($_GET['foto'])) { $fotonaam = $_GET['foto']; $mapnaam = 'albums/' . $_GET['album']; echo '<img src="' . $mapnaam . '/' . $fotonaam . '" alt="' . $fotonaam . '"/>'; } ?> the following page is the index with the 3 includes: <body> <div id="albums"> <?php include 'toonalbums.php'; ?> </div> <div id="albuminhoud"> <?php include 'toonalbuminhoud.php'; ?> </div> <div id="foto"> <?php include 'toonfoto.php'; ?> </div> </body> When I execute the index I get the following error: "Notice: Undefined index: album in C:\wamp\www\webprogramming\php2\toonalbums.php on line 9" I don't know exactly what's wrong but I think it has something to do with the variables and the '$_GET['album']' code I use in the echo on the 'toonalbum.php' page. Also the map album exists and there are a couple of maps with photo's inside. I hope someone can help me and explain how I can fix the code, because I think I am pretty close to getting it to work.
×
×
  • 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.