Jump to content

loop help


dtdetu

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.