Web Hosting Talk







View Full Version : PHP/mySQL Re-Coding Help Needed


bizbla
12-25-2006, 03:45 AM
Hello,
I am working on a calendar and it is currently setup to show this year (2006) and the future 4 years (2007-2010). What I would like it to do is show those, plus the past 4 years (2005-2002).

Here is the current coding...

//============================
// FUNCTION: show_nav()
// Param: 1
// Desc: Displays Navigation
//============================

function show_nav($date)
{
$data = '<select class="nav_select" onChange="if(this.value!= 0){location=this.options[this.selectedIndex].value}">'."\n";

// Show Years Jan -> Dec..

for ($i=1; $i<13; $i++)
{
$data .= '<option'.(($i<10 ? '0'.$i : $i)==substr($date,0,2) ? ' selected ' : ' ').'value="index.php?date='.($i<10 ? '0'.$i : $i).'-'.substr($date,-4).'">'.$this->get_month(($i<10 ? '0'.$i : $i)).'</option>'."\n";
}

$data .= '</select>'."\n";
$data .= '<select class="nav_select" onChange="if(this.value!= 0){location=this.options[this.selectedIndex].value}">'."\n";

// Show Years. Current Year + 5 Years..

for ($i=date("Y"); $i<date("Y")+5; $i++)
{
$data .= '<option'.(substr($date,0,2).'-'.$i==substr($date,0,2).'-'.substr($date,-4) ? ' selected ' : ' ').'value="index.php?date='.substr($date,0,2).'-'.$i.'">'.$i.'</option>'."\n";
}

$data .= '</select>'."\n";

return $data;
}

Can someone show me the correct coding to make this happen? I would be very gratefull and can offer a free link placement for you in BizBla.com's link directory (normal cost is $5.00).

orbitz
12-25-2006, 04:17 AM
change the line where

for ($i=date("Y"); $i<date("Y")+5; $i++)

to

for ($i=date("Y")-4; $i<date("Y")+5; $i++)

bizbla
12-25-2006, 04:36 AM
That did it. It sure seems so simple now LMAO.

If you want to PM me with a URL, Title, and description, I will get your site added into BizBla's link directory.

Thank you very much for your help!

orbitz
12-25-2006, 05:30 AM
thank you for your offer, but it was the least I could do.