I'm building an application that have to add a row in a MyPHP database with some data, included for each row an always different, small JPEG image. At the moment it is structured like this:
JavaScript
function fn_addrow() {
document.write('<form action="ADVBKMNGR-EventClass_MANAGE.php?Mode=ADD" method="POST" enctype="multipart/form-data">')
document.write('<table width="500"><th width="150"></th><th width="350"></th>')
document.write('<TR>')
// Form building
document.write('<input type="submit" value="Ok proceed">')
document.write('</form>')
}
PHP
elseif($WorkMode == 'ADD'):
$ID_ev = $_POST[ID_evcls];
$ID_ds = $_POST[Desc];
// Write all the data in a new row
$query='INSERT INTO '.$db_tabscelta.' (`Cod_App`, `ID_eventclass`, `Descrizione`, `Active`, `Logo_Eve`) VALUES ("'.$Station_ID.'","'.strtoupper($ID_ev).'","'.$ID_ds.'","1","'.mysql_real_escape_string($datimmagine).'")';
$result = mysql_db_query("AdVisual_02_", $query ,$connessione);
unlink($ID_logo);
imagedestroy($ID_logo);
The call at the PHP side works, the record is added, but my problem is that at the end I remain on the PHP page, while I would like to return to the calling page and redisplay the whole table. And, the address of the PHP is displayed in the user screen, and I would NOT like this at all.
Does anybody have suggestions?
Very important: I've tried the way with the XMLHttpRequest()
command. It's fine, but I'm not able to upload the image at all.