Hi All
I need some help with how to reload a webpage after submitting a form. My page is being used to add information to a database. Once the user has clicked submit, the info is added and then a blank screen is displayed. I would like the upload form to display again. Can anyone help me with this please.
This is my code so far...
<div id="image">
<h3>Add New Image</h3></br>
<form action="uploadPictures.php" method="post">
Image Description:<br/>
<textarea cols="50" rows="4" name="imageDescription">
</textarea><br/>
Path:<br/>
<input type="file" name="path"/><br/>
Select Album:<br/>
<?php
$sql = "SELECT ID, Title FROM albums";
$result = mysql_query($sql) or die(mysql_error());
echo '<select name="albumMenu">';
while($row = mysql_fetch_assoc($result))
{
printf('<option value="%s">%s</option>', htmlspecialchars($row['ID']), htmlspecialchars($row['Titles']));
}
echo '</select>';
?>
<br/><br/>
<input type="submit" value="Add New Image"/>
</form>
</div>
and this is uploadPictures.php...
.....
.....
// get last ID in 'pictures' table
$result = mysql_query("SELECT * FROM pictures ORDER BY ID desc limit 1") or die('order images error');
$row = mysql_fetch_array($result);
$newID = $row['ID'] + 1;
// insert new image into 'pictures' table
$insert = "INSERT INTO pictures (ID, Description, Path) VALUES ($newID, '{$_POST['imageDescription']}', '{$_POST['path']}')";
mysql_query($insert) or die(mysql_error());
// insert record into 'pics_in_albums' table
$insert2 = "INSERT INTO pics_in_album (PicID, AlbumID) " .
"VALUES ($newID, '{$_POST['albumMenu']}')";
mysql_query($insert2) or die('insert into pics_in_album errors');
Thanks everyone.