dtdetu Posted December 3, 2008 Share Posted December 3, 2008 hello i have a little script which has 2 loops in it , i post some value to the script page and it works for me but someone used this script tells me that it doesnt go to the script page after post but goes when the loop finishes in the page. sorry for bad english i hope someone can understand what i mean. i mean foreach($fall[1] as $val) { echo $val; } it doesnt load the page and echos the val , when click submit form page doesnt go to script page until the loop finishes and after that it goes and echos all content, does anyone have any idea why this happens Link to comment https://forums.phpfreaks.com/topic/135330-loop-help/ Share on other sites More sharing options...
waterssaz Posted December 3, 2008 Share Posted December 3, 2008 forgive my ignorance but can you try and explain a bit clearer waht you are trying to do and I may be able to help Link to comment https://forums.phpfreaks.com/topic/135330-loop-help/#findComment-704864 Share on other sites More sharing options...
dtdetu Posted December 3, 2008 Author Share Posted December 3, 2008 ok i have 2 page , one of them is form.php and other one is script.php when i go to form.php and click submit button (form action is script.php) it sends me to script.php and in script.php i get new line for every loop values, normally it works like this. but in this situation when i go to form.php and click submit button it doesnt send me to script.php until all loops finishes in script.php after that scripts.php opens and shows me the values. Link to comment https://forums.phpfreaks.com/topic/135330-loop-help/#findComment-704867 Share on other sites More sharing options...
waterssaz Posted December 3, 2008 Share Posted December 3, 2008 sorry from that small snippet fo code and explanation I am trying hard to visualise your problem. I will have to leave it to someone else to help you :-( Link to comment https://forums.phpfreaks.com/topic/135330-loop-help/#findComment-704875 Share on other sites More sharing options...
ryanyoungsma Posted December 3, 2008 Share Posted December 3, 2008 From what I am reading you want the script.php page to write out the value and post it to the page each time, versus display the final results after the code is executed. I do not believe that PHP works like this. All PHP code is executed on the server first then the document is generated. I am thinking that you would need to use JavaScript and AJAX to perform the loop so that at each response you can update the page. Link to comment https://forums.phpfreaks.com/topic/135330-loop-help/#findComment-704879 Share on other sites More sharing options...
dtdetu Posted December 3, 2008 Author Share Posted December 3, 2008 no i want to see the results on script.php but i want to see them immediately after posting, now it waits in form.php until all the script runs then sends me to script.php and show the content, normally it should send me to script.php and add values to content each time loop works. Link to comment https://forums.phpfreaks.com/topic/135330-loop-help/#findComment-704884 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.