Jump to content

Confirm Box Before Save Data


newphpcoder

Recommended Posts

Hi...I have a button to generate data or save all data in the database.Now, I want that when i click the button to generate data it will not save all data, i want first appear an alert or confirm box asking if "Do you want to save data?" and i want it has a OK and Cancel...when the OK was pressed it will automatically save data and when the Cancel was pressed the alert/confirm box will closed?Is it possible?Can you give me an idea or example..But now i searching also for that.here is my code:

<input type="button" name="GENERATE_DATA" value="GENERATE DATA" style="width: 200px;">

and i have a php file for saving data...Thank you so much

Link to comment
Share on other sites

I would think you need the button to submit the data to not actually submit but rather open a function with your dialog box and that dialog box will have the ok button attached to the function that will save the data. Like this (do not copy and paste this is simply rough)

function confirm(){var r=confirm("Is your data correct?")if (r==true)  {  saveData()  }}function saveData()}//Whatever you need to distinguish the input fields and to save the data.{

Hope that is clear.

Link to comment
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...