mme Posted December 2, 2008 Share Posted December 2, 2008 Hi why doesn't this code work ? Its supposed to include the the relevant page with the .html extension except when it is the testimonials page then its a .php extension <? $pages = array("home","about","where","how","testimonials","contact","site_map"); $go=$pages[0] . ".html"; for ($i=0;$i<count($pages);$i++) { if (strtolower($_GET['page'])==$pages[$i]) { if ($pages[$i]="testimonials") {$go=$pages[$i] . ".php";} else { $go=$pages[$i] . ".html";} break; } } include($go); ?> Quote Link to comment Share on other sites More sharing options...
flyhoney Posted December 2, 2008 Share Posted December 2, 2008 Use the == operator for comparisons: <?php $pages = array( "home", "about", "where", "how", "testimonials", "contact", "site_map" ); $go = $pages[0] . ".html"; for ($i = 0; $i < count($pages); $i++) { if (strtolower($_GET['page']) == $pages[$i]) { if ($pages[$i] == "testimonials") { $go = $pages[$i] . ".php"; } else { $go = $pages[$i] . ".html"; } break; } } include($go); ?> Quote Link to comment Share on other sites More sharing options...
mme Posted December 2, 2008 Author Share Posted December 2, 2008 Thanks so much All working now 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.