I have a PHP file executing, which inserts entries into the database, and when a condition is met (for example, $rows>500) i want to halt the execution, and two buttons to appear.
One with the value “Continue” to continue the execution of the script from where it stopped and one with “Cancel” to delete the entries that have been inserted until now, through the script.
The problem is that i cannot think of a way for stopping the execution, displaying the two buttons and then depending to my option an action to be taken.
Do I need some Javascript and AJAX?
Thanks in advance! Any help is appreciated!
Have you tried using exit(); in the script? this exits the code, thus halting it.
for the continue you could store the pos you were at in an session.
Then with an ajax request you could start again at the spot you left off, using the stored ‘pos’ in your session..
EDIT:
For ajax you will need a php script and a way to call the script from your button. I would use jquery for it. since you prob already have that on your site, you can just use:
What this does is call the script test.php and brings back any data into a javascript variable called data.. and then it puts this data inside of the .result element.
Depending on your type of application you would have to mess around with this a bit to get your data where you need it. but this should get you into the right direction.
Hope this helped!