Re: Re: Rewriting string

From: Date: Thu, 13 Jan 2011 20:36:15 +0000
Subject: Re: Re: Rewriting string
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-310744@lists.php.net to get a copy of this message
Nathan Rixham wrote:
Admin wrote:
$categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 'testimonials');
If(in_array($_GET['page'], $categories)) { echo '<li><a href=index.php?page='.$_GET['page'].'>'.str_replace("_"," ",$_GET['page']).'</a></li>'; }else{ echo '<li>'.str_replace("_"," ",$_GET['page']).'</li>'; } I normally never write someones code for them but you are just not getting it. The above code works use it.
i assume you're joking - that code is simply going to give 6 list items all with the same value - $_GET['page'] please do check you know what you're talking about before you post.
and ironically, that's wrong - it's only going to show it once, with or without a link, but isn't going to do what the OP wanted.

« previous php.general (#310744) next »