kigogu Posted June 8, 2012 Share Posted June 8, 2012 I want to be able to display the same thing multiple times, but the amount depends on what the user had input in on the previous page. How would I go about accomplishing this? I can use a $_GET['X'] to get the variable amount, but I don't know how to use it to where I can loop through something X amount of times. Quote Link to comment Share on other sites More sharing options...
Jessica Posted June 8, 2012 Share Posted June 8, 2012 Are you asking how to do a for loop? <?php for($i=0; $i<$x; $i++){ //code } ?> Quote Link to comment Share on other sites More sharing options...
kigogu Posted June 8, 2012 Author Share Posted June 8, 2012 Not really, what I want to do is loop through a form that I would have in html multiple times, so like when I click submit on one form it would basically grab that information and then refresh to the same form for them to input again. I guess it would just be a matter of what would i put in the submit button to call? Quote Link to comment Share on other sites More sharing options...
Jessica Posted June 8, 2012 Share Posted June 8, 2012 That is completely different from your first post. Â And what you're saying now doesn't make any sense. Quote Link to comment Share on other sites More sharing options...
kigogu Posted June 8, 2012 Author Share Posted June 8, 2012 sorry lol, alright so I have one page where someone inputs a number, X, then hits submit. Once they hit submit it goes to a form page where they can enter information. What I want to do is take the number from the first page and display the form page that number of times. I will have a submit button where once they click that, I will then get their information, and then display the form again until they have gone through the form page X number of times. Quote Link to comment Share on other sites More sharing options...
Jessica Posted June 8, 2012 Share Posted June 8, 2012 You'd need to store the number of times to show the form in a session/hidden input. Then check if it's greater than 0. If it is, show a form and decrement it. When it hits 0, move on. Since you have many forms you need to keep storing the results in the session or in hidden inputs (unless you process it each time and add it to your DB or whatever you're doing with it) Quote Link to comment Share on other sites More sharing options...
kigogu Posted June 8, 2012 Author Share Posted June 8, 2012 ....totally forgot about sessions =___= thanks xD sorry for being all complicated in my explanation Quote Link to comment 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.