Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Highlighted selected link from list 1

Status
Not open for further replies.

lagc

Programmer
Jan 21, 2009
79
GB
I have a script that pulls all countries out of the database and displays them as a list.

The customer can select any of the countries, which will then display all the regions within that country, again for the customer to select before they move onto the next stage.

What I would like to do, is to change the colour of the country they selected and then the region, so the customer knows what they have selected.

This is what I currently have:

Code:
<?php
$r=mysql_query("select Id_Cntry, Nom_Cntry from tbl_countries order by Nom_Cntry");
while($q=mysql_fetch_assoc($r)){
?>
<a href="index.php?Onestep_Cntry=1&Twostep_Cntry=1&ID_step=<?=$q['Id_Cntry']?>#tailor" class="bodySmall1New2" title="Hotels In <?=$q['Nom_Cntry']?>"><?=$q['Nom_Cntry']?> </a>
<?php } ?>

So basically what I'm trying to do is have a visable change in the choice selected, so they can see what they have chosen, like 'selected' when doing it in css.
 
assume that you have a class in your css declarations

CSS:
.selected {background-color:green;}

Code:
<?php
$r=mysql_query("select Id_Cntry, Nom_Cntry from tbl_countries order by Nom_Cntry");
while($q=mysql_fetch_assoc($r)){
?>
[red]$selected = (isset($_GET['ID_step']) && $_GET['ID_step'] == $q['Id_Cntry']) ? 'selected':'';[/red]
<a href="index.php?Onestep_Cntry=1&Twostep_Cntry=1&ID_step=<?=$q['Id_Cntry']?>#tailor" class="bodySmall1New2 [red]<?php echo $selected;?>[/red]" title="Hotels In <?=$q['Nom_Cntry']?>"><?=$q['Nom_Cntry']?> </a>
<?php } ?>
 
Oh fair play, that works a treat...

Thank you

Perfect
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top