PHP - Links: From Thumbs to page.php
<p>I need to link 9 thumbs called: <code>project1.jpg, project2.jpg, project3.jpg</code>... to php pages with the same name: <code>project1.php, project2.php, project3.php</code>.</p>

<p>It's my code so far:</p>

<pre><code>&lt;?php

$dir = 'portfolio/print/img/thumbs/';
$main_page ='portfolio/print/project1'; // How can I make $main_page to show the right project each time? 
$scan = scandir($dir);

for ($i = 0; $i&lt;count($scan); $i++) {   
if ($scan[$i] != '.' &amp;&amp; $scan[$i] != '..') {
 if (strpos($scan[$i], '.png') !== false) {
    $curr = substr($images[$i], 0, strlen($images[$i]) -4) . ".php";

  echo '&lt;li&gt;
    &lt;a href="'. *** $main_page *** . $curr . '"&gt;
    &lt;img src="' . $dir . $scan[$i] . '" alt="' . $scan[$i] . '" /&gt;
    &lt;strong&gt;'. $scan[$i] .'&lt;/strong&gt;
    &lt;/a&gt;               
     &lt;/li&gt;';
  }
 }

};    

?&gt;
</code></pre>

<p><em>*</em> Do I need to create loop to find out the right link to each page? I am not really sure how to do it. </p>

<p>Thank you!! </p>
