Jump to content

Help with nav tabs and css


DBookatay

Recommended Posts

I have a script that pulls data from my dB based on the year selected from 2006 - 2011, and if no year is selected it automatically loads the current year, 2011.

 

I have a css that changes the design of the "tab" based on the year selected, but how do I make it so that the "On" style reflects the current year tab if no year is selected?

 

Confused yet? I created an image of what I mean as well as the php script.

 


if ($_GET['date']) {$year = ($_GET['date']);} else {$year = date("Y");}

$query = "select DISTINCT YEAR(sold_date) AS `sold_date` FROM Sold WHERE sold_date ORDER BY sold_date DESC";
$result = mysql_query($query);
$numrows = mysql_num_rows($result);
while($row = mysql_fetch_array($result)){

$year = $row['sold_date'];

if ($_GET['date'] == $year) {
	$class = "On";
} elseif ($_GET['date'] != $year) {
	$class = "";
}

$miniNav .= '<a class="'.$class.'" href="index.php?date='.$year.'">'.$year.'</a>';
}



 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/226749-help-with-nav-tabs-and-css/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.