Page 1 of 1

Confirmation dialog with server message

Posted: Thu Jun 26, 2008 9:42 pm
by pdittman
Hi,

I'm trying to write a delete file confirmation capability - php generates a list of files to delete, the user selects a file, with javascript confirmation on the client, and a message gets sent back to the server to delete the file. I've got the filelist generated and have the javascript confirmation, but I really want the original page displayed, not the php page that's called to actually delete the file.

The snippet I have is:


<form name="form1" method="post" onsubmit="return validate_selection(this);"
action="action.php?link=delete_file"><b>Delete File</b><br>

<select name="delete_file" size="3" id="delete_file">
<option value="file_1">File_1</option>
<option value="file_2">File_2</option>
<option value="file_3">File_3</option>
<option value="file_4">File_4</option>
</select>
<input type="submit" name="Submit" value="Delete">

< other stuff >

where validate_selection() does the confirmation and action.php performs the actual delete. But I don't want the <other stuff> removed from the screen after the exchange with the user....

what am I missing?

thanks in advance...

-Peter

Re: Confirmation dialog with server message

Posted: Fri Jun 27, 2008 4:01 am
by WebbieDave
After deleting, you can redirect the visitor back to whichever page you wish with header('Location: yourpage.php'). Another approach would be to use AJAX to perform the delete.