<?php// an array of available wallpapers // in your case, you fetch it from a directory listing; here I just define an array for simplicity$wallpapers = ('1.jpg','2.jpg','3.jpg');// check if a new wallpaper was requested, if it was, and it is a valid wallpaper, // set the $wallpaper variable to it, otherwise set the wallpaper to be the first// out of the $wallpapers array.$wallpaper = isset($_REQUEST['wallpaper']) && in_array($_REQUEST['wallpaper'], $wallpapers) ? $_REQUEST['wallpaper'] : $wallpapers[0];?><html><body style="background-image: url(<?php echo $wallpaper?>);"><?php// loop through available wallpapers and show the link with an image file// in your example, you do this in an included file, and print out a table // here I print just a list for simplicityforeach($wallpapers as $image){ echo '<a href="index.php?wallpaper='.$image.'"><img src="/wallpapers/'.$image.'"></a>';}?></body></html>