RSS Forums RSS
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 173 | Replies: 1
Reply
Join Date: Aug 2008
Posts: 4
Reputation: srinivas1236 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
srinivas1236 srinivas1236 is offline Offline
Newbie Poster

presenet day

  #1  
Aug 19th, 2008
hi hello,

i want the php function ,for display defaultly the present day in dropdown and i want all the 31 days in same dropdown..

bye
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: Cologne, Germany
Posts: 127
Reputation: sDJh is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 10
sDJh sDJh is offline Offline
Junior Poster

Re: presenet day

  #2  
Aug 20th, 2008
as simple as this:
<?
//Getting the current day:
$today=date("d");

//String for the dropdown...
$dropstring="<select>";
for($x=1;$x<=31;$x++){
$c="";
if($x==$today)$c=" selected";
$dropstring.="<option value=\"".$x."\"".$c.">".$x."</option>";
}
$dropstring.="</select>";
echo $dropstring;
?>

This should work, even though I haven't tested. If you find an error it must be something like missing ; or bracket. If it's not working properly please ask again^^.

Greetings
Simon
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:02 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC