I setup a little site for my roomate whose an artist, and I set it up where he could use an admin.php page to upload images to the site, and they are added to a MYSQL Database where the main site pulls them from and displays them.
He wants the option to remove images from the same page he adds images, so I wrote a little code to display them again and add a "remove" link to each one. I can't figure out what a good way would be to actually code the rest of it where it actually removes the image when he clicks it.
Can anyone possibly shed some light, urls, etc. that may help to get this finished? Here is what the admin.php looks like thus far...
<html>
<head><title>SethClem.com Image Management</title></head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
Image File: <input type="file" name="image" /><br />
Description: <input type="text" name ="description" ><br>
<input type="submit" value="upload" />
</form>
<?php
include("../database.php");
// Connects to your Database
mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error()) ;
mysql_select_db($dbname) or die(mysql_error()) ;
//Retrieves data from MySQL
$data = mysql_query("SELECT * FROM images") or die(mysql_error());
?>
<div style="width:100%; height:105px; border:0 ; padding:5px;">
<table><tr>
<?php
//Puts it into an array
while($info = mysql_fetch_array( $data ))
{
$image = "../images/".$info['image'];
?>
<td>
<img src="<?php echo $image ?>" style="width:191; height:124; border:0px ; float:left;" />
<a href="_blank">remove</a>
</td>
<?php
}
?>
</tr>
</table>
</div>