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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.