Hello all,
I have a php function that deletes the contents of a database table that relies on a javascript confirm box to tell it what to do as follows
javascript function as follows
function deleteMasterList()
{
var outcome = confirm("Delete Master List, you will have to re-enter all band genres");
if(outcome)
{
alert(outcome);
<?php removeFromMasterList ?>
}
}
I now know this won't work as it will execute the php no matter what so I did this
function deleteMasterList()
{
var outcome = confirm("Delete Master List, you will have to re-enter all band genres");
if(outcome)
{
alert(outcome);
window.location = "http://localhost/AA_Directory_Reader/delete.php" ;
}
}
which is going to take me to a page that deletes the data from the database base then redirects back to the main page
except it does not take me there or to any other working web url I enter
this is the form i call it with
echo '<form action="index.php" method="post" onSubmit="return(deleteMasterList())">';
echo '<input type="submit" name="delete_master_list" value="Delete Master List" /><br / >';
echo '</form>';
ideally I would like it to be one button press to get the confirm box to appear and then another to confirm or cancel, most examples I can find online use <a href> to link and do it via link to call there page not javascript
any ideas ?
cheers