silver_fox4me Posted March 28, 2008 Share Posted March 28, 2008 HI, i'm doing a php project and have a page where the admin can delete the pupil. I've got a button that is a graphic that deletes the selected checkbox when you hit the button. What i'm trying to do is to get a javascript confirmation up is yes/no. All i've been able to do so far is the same but with a basic submit button, not the graphic. Any ideas..... much appreciated following code works- but just with normal boring submit, code for graphic is below this <form name='myform' action='delete_selected_option.php' method='POST'> </form> ************** function confSubmit(form) { if (confirm("please confirm you wish to delele these records")) { form.submit(); } else { alert("records were not deleted"); } } ******************************************* button i want the above to have a similar affect. (currently the check comes up with same code above but with the graphic input, but when i hit cancel it still submits the form <input type='image' src='../Graphics/delete_record.gif' onClick='confSubmit(this.form);' value='Submit Form' align='right' alt='click to delete record'/> Link to comment https://forums.phpfreaks.com/topic/98289-delete-button-help-problem/ Share on other sites More sharing options...
zenag Posted March 28, 2008 Share Posted March 28, 2008 try this...u should return values like this... function confSubmit(form) { if (confirm("please confirm you wish to delele these records")) { form.submit(); } else { alert("records were not deleted"); }return false; } <input type='image' src="" onClick=' return confSubmit(this.form);' value='Submit Form' align='right' alt='click to delete record'/> Link to comment https://forums.phpfreaks.com/topic/98289-delete-button-help-problem/#findComment-502958 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.