I am building an image gallery that i want users to have administrative access to, the image uploader creates images resized to a specific size, and a thumbnail of the image in another directory, both file names, as well as a caption, and "folder name" for sorting the images are then stored in a mysql database. To edit the gallery i want to show all images in relation to their respective folders with textareas to edit edit the filename, and caption and a checkbox that could be used to delete the image, i have the forms created, but how do i process the form to update the rows that need to be changed?
code so far :
<form name="editgallery" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="hidden" name="action" value="submitedit">
<?php
include('dbinclude.inc');
MYSQL_CONNECT("$dbhost","$dbusername","$dbuserpassword");
mysql_select_db("$dbname");
$result = mysql_query("SELECT DISTINCT folder FROM gallery ORDER BY folder ASC");
while($query_data = mysql_fetch_row($result)) {
$folder = $query_data[0];
?>
<br clear="all">
<hr>
<?php echo $folder ?>
<input type="checkbox" name="delete<?php echo $folder ?>"> Delete
<br><hr>
<?php
$result2=MYSQL_QUERY("SELECT id, folder, name, caption, width, height, filesize, twidth, theight FROM gallery WHERE folder = '$folder' ORDER BY name ASC");
while($query_data2 = mysql_fetch_row($result2)) {
$id = $query_data2[0];
$folder = $query_data[1];
$name = $query_data2[2];
$caption = $query_data2[3];
$width = $query_data2[4];
$height = $query_data2[5];
$filesize = $query_data2[6];
$twidth = $query_data2[7];
$theight = $query_data2[8];
$th = (100 - $twidth) * .5;
$tv = (100 - $theight) * .5;
?>
<div style="width:200px; height:300px; margin:7px; float:left;">
<div style="height:100px; width:200px;">
<div style="margin-left:50px; margin-right:50px; height:100px; width:100px; text-align:center; padding-left:<?php echo $th ?>px; padding-top:<?php echo $tv ?>px;">
<a href="javascript:popImage('images/<?php echo $name ?>','Gallery Photos')">
<img border="0" src="images/thumbs/<?php echo $name ?>" style="vertical-align:middle;">
</a>
</div>
</div>
<div>
Id: <?php echo $id ?>
</div>
<div>
Name:<br><input type="text" name="name<?php echo $id ?>" value="<?php echo $name ?>" size="26">
</div>
<div>
Caption:<br><textarea><?php echo $caption ?></textarea>
</div>
<div>
Size: <?php echo $width ?>w X <?php echo $height ?>h
</div>
<div>
Filesize: <?php echo $filesize ?> bytes
</div>
<div>
<input type="checkbox" name="delete" value="delete<?php echo $name ?>"> Delete
</div>
</div>
<?php
}
mysql_free_result($result2);
}
mysql_free_result($result);
MYSQL_CLOSE();
?>
<br clear ="all">
<hr><input type="submit" name="submit" value="submit edit">
</form>
the url is http://www.cnidesigns.com/demos/photo_uploader/galleryedit.php
if this is not complete enough information or a clear enough request to answer please email me at woody@cnidesigns.com
Thank you,
Woody