Hi there
I have a form that I'm trying to submit but it just doesn't want to play nice.
The form i have has 2 submit buttons. One processes php code that updates info in a DB and the other deletes the info in the DB. The problem is that I have a popup asking for confirmation on the deleting and when I click ok nothing happens. All I need to know is how to submit my form using javascript so that it processes the PHP code to delete the DB entry.
form tag and delete button
<form name="formname" id="formname" method="post" action="<?= $_SERVER['PHP_SELF']?>" onSubmit="return checkWholeForm(this);">
<input onclick=\"confDelete()\" type="submit" name="delete" value="Delete">
confirmation popup
<script type="text/javascript">
<!--
function confDelete() {
var answer = confirm("Msg")
if (answer==true){
document.formname.submit();
return true;
}
}
//-->
</script>
Code that deletes DB entry
if (isset($_POST['formname'])){
\\ code goes here
}