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