Looking through the posts on this forum I found this code for confirming delete
Code: Select all
<form action='deleterecord.php' method='POST' onsubmit='return confirm("Are you sure?");'>
<input type='hidden' name='id' value='123' />
<input type='submit' name='delete' value='Delete record' />
</form>
Also the one suggested above
I get the impression that this refers to a process page, my code does not link to a process page. It processes within the page.
So can someone show me how to do this delete are you sure within the same file?
Also I have 2 submit buttons one for save and one for delete.
how will I apply the javascript to the submit which links to the Delete submit and not the save submit?
My code for both save and delete are below:
Save
Code: Select all
if(isset($_GET['org_id'])){
$org_id=$_GET['org_id'];
}
if ($_POST['Submit'] == 'Save'){
foreach ($_POST as $formName => $phpName){
$$formName = $phpName;
}
Delete
Code: Select all
}
if ($_POST['action'] == "Delete Record"){
$delete = mysql_query("DELETE FROM organisations WHERE org_id = '$org_id'") or die(mysql_error()); }
echo "<form action=\"editorganisations.html?org_id=$org_id\" method=\"post\">
<input type=\"hidden\" name=\"action\" value=\"Delete Record\">
<input type=\"submit\" value=\"Delete Record\">
</form>
</td><p>";
Any help much appreciated.