Forum Moderators: coopster
<?php
//connect to the database
$link = mysql_connect("localhost", "admin", "pass")
or die("Could not connect: " . mysql_error());
mysql_select_db("gallery", $link)
or die (mysql_error());
$folder_location = $_POST['folder_location'];
$picture_id = $_POST['picture_id'];
$ImageDir = $_POST['ImageDir'];
$ImageThumb = $_POST['ImageThumb'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Delete Image Confirm</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
echo "folder location: <b>$folder_location</b> and picture id: <b>$picture_id</b>";
echo "Image Dir: <b>$ImageDir</b> and ImageThumb: <b>$ImageThumb</b>";
?>
<p align="center">Listing of picture to be deleted</p>
<table align="center">
<?php
//tell database which folder to display
switch ($folder_location) {
case "centerpieces":
$getpic = mysql_query("SELECT * FROM gallery_centerpieces WHERE image_id=$picture_id")
or die(mysql_error());
while ($rows = mysql_fetch_array($getpic)) {
extract($rows);
echo "<tr>\n";
echo "<td><a href=\"".$ImageDir . $image_id . ".jpg\">";
echo "<img src=\"" . $ImageThumb . $image_id . ".jpg\" border=\"0\">";
echo "</a></td>\n";
echo "<td>" . $image_id . "</td>\n";
echo "</tr>\n";
}
break;
case "classicdecor":
$getpic = mysql_query("SELECT * FROM gallery_classicdecor")
or die(mysql_error());
while ($rows = mysql_fetch_array($getpic)) {
extract($rows);
echo "<tr>\n";
echo "<td><a href=\"".$ImageDir . $image_id . ".jpg\">";
echo "<img src=\"" . $ImageThumb . $image_id . ".jpg\" border=\"0\">";
echo "</a></td>\n";
echo "<td>" . $image_date . "</td>\n";
echo "<td>" . $image_id . "</td>\n";
echo "</tr>\n";
}
break;
case "dancefloors":
$getpic = mysql_query("SELECT * FROM gallery_dancefloors")
or die(mysql_error());
while ($rows = mysql_fetch_array($getpic)) {
extract($rows);
echo "<tr>\n";
echo "<td><a href=\"".$ImageDir . $image_id . ".jpg\">";
echo "<img src=\"" . $ImageThumb . $image_id . ".jpg\" border=\"0\">";
echo "</a></td>\n";
echo "<td>" . $image_date . "</td>\n";
echo "<td>" . $image_id . "</td>\n";
echo "</tr>\n";
}
break;
case "deliverybouquets":
$getpic = mysql_query("SELECT * FROM gallery_deliverybouquets")
or die(mysql_error());
while ($rows = mysql_fetch_array($getpic)) {
extract($rows);
echo "<tr>\n";
echo "<td><a href=\"".$ImageDir . $image_id . ".jpg\">";
echo "<img src=\"" . $ImageThumb . $image_id . ".jpg\" border=\"0\">";
echo "</a></td>\n";
echo "<td>" . $image_date . "</td>\n";
echo "<td>" . $image_id . "</td>\n";
echo "</tr>\n";
}
break;
case "propsandeffects":
$getpic = mysql_query("SELECT * FROM gallery_propsandeffects")
or die(mysql_error());
while ($rows = mysql_fetch_array($getpic)) {
extract($rows);
echo "<tr>\n";
echo "<td><a href=\"".$ImageDir . $image_id . ".jpg\">";
echo "<img src=\"" . $ImageThumb . $image_id . ".jpg\" border=\"0\">";
echo "</a></td>\n";
echo "<td>" . $image_date . "</td>\n";
echo "<td>" . $image_id . "</td>\n";
echo "</tr>\n";
}
break;
case "stagedecor":
$getpic = mysql_query("SELECT * FROM gallery_stagedecor")
or die(mysql_error());
while ($rows = mysql_fetch_array($getpic)) {
extract($rows);
echo "<tr>\n";
echo "<td><a href=\"".$ImageDir . $image_id . ".jpg\">";
echo "<img src=\"". $ImageThumb . $image_id . ".jpg\" border=\"0\">";
echo "</a></td>\n";
echo "<td>" . $image_date . "</td>\n";
echo "<td>" . $image_id . "</td>\n";
echo "</tr>\n";
}
break;
case "themedecor":
$getpic = mysql_query("SELECT * FROM gallery_themedecor")
or die(mysql_error());
while ($rows = mysql_fetch_array($getpic)) {
extract($rows);
echo "<tr>\n";
echo "<td><a href=\"".$ImageDir . $image_id . ".jpg\">";
echo "<img src=\"" . $ImageThumb . $image_id . ".jpg\" border=\"0\">";
echo "</a></td>\n";
echo "<td>" . $image_date . "</td>\n";
echo "<td>" . $image_id . "</td>\n";
echo "</tr>\n";
}
break;
case "tradeshows":
$getpic = mysql_query("SELECT * FROM gallery_tradeshows")
or die(mysql_error());
while ($rows = mysql_fetch_array($getpic)) {
extract($rows);
echo "<tr>\n";
echo "<td><a href=\"".$ImageDir . $image_id . ".jpg\">";
echo "<img src=\"" . $ImageThumb . $image_id . ".jpg\" border=\"0\">";
echo "</a></td>\n";
echo "<td>" . $image_date . "</td>\n";
echo "<td>" . $image_id . "</td>\n";
echo "</tr>\n";
}
break;
case "weddings":
$getpic = mysql_query("SELECT * FROM gallery_weddings")
or die(mysql_error());
while ($rows = mysql_fetch_array($getpic)) {
extract($rows);
echo "<tr>\n";
echo "<td><a href=\"".$ImageDir . $image_id . ".jpg\">";
echo "<img src=\"" . $ImageThumb . $image_id . ".jpg\" border=\"0\">";
echo "</a></td>\n";
echo "<td>" . $image_date . "</td>\n";
echo "<td>" . $image_id . "</td>\n";
echo "</tr>\n";
}
break;
default:
echo "Sorry, but the location you selected was not correct.<br>";
echo "Please hit your browser's 'back' button and try again.";
}
<p>Are you sure you want to delete this picture from your gallery?</p>
?>
</body>
</html>
add this to your <p>Are you sure..
<tr><td colspan=99 align=center>
<p>Are you sure you want to delete this picture from your gallery?</p>
</td></tr></table>
Be sure to close the table at some point, but I'd do it here. Your message should appear as it's own row underneath all others.