StefanRSA Posted June 23, 2009 Share Posted June 23, 2009 I want to number my links: If <? $number = 5; ?> How can I create number of links and as follow? echo "<a href='../member/myad.php?ad=1'>Create Ad 1</a><br> <a href='../member/myad.php?ad=2'>Create Ad 2</a><br> <a href='../member/myad.php?ad=3'>Create Ad 3</a><br> <a href='../member/myad.php?ad=4'>Create Ad 4</a><br> <a href='../member/myad.php?ad=5'>Create Ad 5</a><br>" ; and also make sure that not more than 5 links appear? Link to comment https://forums.phpfreaks.com/topic/163401-number-array-to-number-links/ Share on other sites More sharing options...
flyhoney Posted June 23, 2009 Share Posted June 23, 2009 You mean something like this? <?php $number_of_links = 5; for ($x = 0; $x < $number_of_links; $x++) { echo '<a href="../member/myad.php?ad='.$x.'">Create Ad '.$x.'</a><br />'; } Link to comment https://forums.phpfreaks.com/topic/163401-number-array-to-number-links/#findComment-862139 Share on other sites More sharing options...
StefanRSA Posted June 23, 2009 Author Share Posted June 23, 2009 I would nominate you as a FlyHoney! Thanks... I am still learning PhP and this was maybe one of the most important lesson you helped me with! Link to comment https://forums.phpfreaks.com/topic/163401-number-array-to-number-links/#findComment-862142 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.