PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 8th, 2004, 06:37 PM
nmphpwebdev nmphpwebdev is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 6 nmphpwebdev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Trouble with a date select box

I have this date select box (for months only )

PHP Code:
echo "<form action=\"index.php\" method=\"GET\">\n";
                echo 
"<table border=\"1\">\n";
                    echo 
"<th colspan=\"2\">View Other Months</th>\n";
                    echo 
"<tr>\n";
                        echo 
"<td>\n";
                            echo 
"<select name=\"months\">\n";
                                foreach (
$months as $key => $val ) {
                                    (
$key == date('m'time())) ? ($sel " selected") : ($sel "");
                                    echo 
"<option value=\"".$key."\"$sel>".$val."</option>\n";
                                } 


When i select a month earlier than the current month ( october so fa ), there is 10 added to the month. January become 11, February becomes 12 and so on.

I have tried to change it here:
PHP Code:
echo "<form action=\"index.php\" method=\"GET\">\n";
                echo 
"<table border=\"1\">\n";
                    echo 
"<th colspan=\"2\">View Other Months</th>\n";
                    echo 
"<tr>\n";
                        echo 
"<td>\n";
                            echo 
"<select name=\"months\">\n";
                                foreach (
$months as $key => $val ) {
                                    (
$key == date('m'time()-10)) ? ($sel " selected") : ($sel "");
                                    echo 
"<option value=\"".$key."\"$sel>".$val."</option>\n";
                                } 


But i haven't solved it yet.

Any ideas??

Reply With Quote
  #2  
Old October 10th, 2004, 03:43 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 997 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 908096 Folding Title: Super Ultimate Folder - Level 2Folding Points: 908096 Folding Title: Super Ultimate Folder - Level 2Folding Points: 908096 Folding Title: Super Ultimate Folder - Level 2Folding Points: 908096 Folding Title: Super Ultimate Folder - Level 2Folding Points: 908096 Folding Title: Super Ultimate Folder - Level 2Folding Points: 908096 Folding Title: Super Ultimate Folder - Level 2Folding Points: 908096 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 14 h 26 m 27 sec
Reputation Power: 5
Send a message via ICQ to Itsacon
I'd do a printout of the $months array, see if its contents are correct

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Trouble with a date select box


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT