Problem with foreach loop and $_GET

Posted by phpExe on Stack Overflow See other posts from Stack Overflow or by phpExe
Published on 2010-06-09T15:40:55Z Indexed on 2010/06/09 15:52 UTC
Read the original article Hit count: 230

Filed under:
|

I have a very simple foreach loop

foreach($tv as $id => $channel) {
$ID = $_GET['ID'];
if($ID == $id){$class = "currentt";}
echo '<a href="http://www.mysite.com/tst.php?ID='.$id.'"     class="'.$class.'">'.$channel.'</a><br>';
 }

With url query, with every click the current class repeated. How can avoid this? Thanks alot.

© Stack Overflow or respective owner

Related posts about php

Related posts about beginner