PDA

View Full Version : array?


tylerh
06-02-2008, 10:06 PM
i'm not sure what to call this, but i'm trying to figure it out

basically what i need is a code where it will output a set code

(example):

<a href="http://example.com/page-graphics.php?img=$number"><img alt="graphics" src="http://example.com/image-$number.png"></a>


but i want it to output the code 50 times and each time the page-graphics.php?img=$number and image-$number.png will be in sequential order (like 1-50)

so it'd be like

<a href="http://example.com/page-graphics.php?img=1"><img alt="graphics" src="http://example.com/image-1.png"></a>

<a href="http://example.com/page-graphics.php?img=2"><img alt="graphics" src="http://example.com/image-2.png"></a>

<a href="http://example.com/page-graphics.php?img=3"><img alt="graphics" src="http://example.com/image-3.png"></a>


and so on

thanks

NancyJ
06-02-2008, 10:18 PM
for($i=1;$i<=50;$i++)
{
echo '<a href="http://example.com/page-graphics.php?img='.$i.'"><img alt="graphics" src="http://example.com/image-'.$i.'.png"></a>';
}

tylerh
06-02-2008, 10:54 PM
Thanks! :thumbsup: