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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.