w32 Posted July 10, 2006 Share Posted July 10, 2006 So yeah I'm trying to make some simple forums of my own, and I'm having a bit of trouble with the pagination. After you post you should be redirected to the page in which you posted, and specifically to your post #. And they way I did it, it worked, except for one thing. You're only redirected to the page in which you posted, but if your post is in a new page, the redirection will not take you there.Here's a bit of the pagination, it's a for loop:[code]for($i=1; $i<=$page_total; $i++) { if(($p)==$i) { echo $i; } else { ?> <a href="<?php $PHP_SELF; ?>?id=<?php echo $_GET['id']; ?>&p=<?php echo $i; ?>"><?php echo $i; ?></a> <?php } }[/code]So I want to add another attribut to that link. I want to add a '&st' attribute, that will have the value of a variable, it's the limit of the posts to be displayed. But if I put it in, every link has the same value.My question is can I make a loop to have that variable be added another variable so each link in the navigaton has its own limit? Can I have a for loop inside another for loop?? Quote Link to comment https://forums.phpfreaks.com/topic/14192-help-me-out-d/ Share on other sites More sharing options...
robos99 Posted July 10, 2006 Share Posted July 10, 2006 You can put another for loop within a for loop. But realize that with a nested for loop, your inner loop is going to run on every iteration of the outside loop. Not sure if that's what you're going for or not....if it is then there ya go.FYI, you don't really need to keep jumping in and out of PHP for the link construction. You can echo html just fine, you only need to escape the quotes, or use single quotes for the html tags, but I seem to recall hearing that single quotes within an html tag was not xhtml compliant, so take it or leave it. Quote Link to comment https://forums.phpfreaks.com/topic/14192-help-me-out-d/#findComment-55662 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.