p.kalom Posted August 17, 2011 Share Posted August 17, 2011 I have in my code a foreach that i want to break it and continue it with a button. For example the loop runs for 10 times and waits the user to press a button. After the button is presses the loop continues. foreach ($rows as $row){ // any code } Quote Link to comment https://forums.phpfreaks.com/topic/245011-break-and-continue-foreach-with-a-button/ Share on other sites More sharing options...
Adam Posted August 17, 2011 Share Posted August 17, 2011 You need to look into JavaScript, or running it through a CLI. When accessed through a browser the PHP is executed on the server, and then the resulting mark-up passed back to the browser once it's complete. The browser can't interact with it during execution for that reason. Quote Link to comment https://forums.phpfreaks.com/topic/245011-break-and-continue-foreach-with-a-button/#findComment-1258502 Share on other sites More sharing options...
p.kalom Posted August 17, 2011 Author Share Posted August 17, 2011 I think that i cannot use Javascript for my code. The reason is that first of all the user can access my code and also in my code there is a db connection and some other scripts that run in PHP. Is there any other way to separate the foreach process?? For your help we are taking for a Joomla mvc component developing, and that process is a function in the model file! Quote Link to comment https://forums.phpfreaks.com/topic/245011-break-and-continue-foreach-with-a-button/#findComment-1258506 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.