Date select box for the current week, or whatever week you give for an offset (in seconds), returns the string you can echo with the select box named $name:
<?php
function week_date_selectbox( $time_offset, $name )
{
if( isset( $time_offset ) )
$t = time() + $time_offset;
else
$t = time();
$wday = array("Sun ","Mon ","Tue ","Wed ","Thu ","Fri ","Sat ");
$mon = array("Jan ","Feb ","Mar ","Apr ","May ","Jun ","Jul ","Aug ","Sep ","Oct ","Nov ","Dec ");
$mybox = "<select name=\"$name\">\n";
for($ii = 0; $ii > -6; $ii--)
{
$tarr = localtime( $t + $ii * 86400, 1 );
if( $tarr["tm_wday"] == 0 )
{
for($jj = 0; $jj < 7; $jj++)
{
$tarr = localtime( $t + ($jj + $ii) * 86400, 1 );
$mybox .= sprintf( " <option value=\"%04d-%02d-%02d\">%s%s%d %d</option>\n",
((int)$tarr["tm_year"] + 1900),
$tarr["tm_mon"],
((int)$tarr["tm_mday"] + 1),
$wday[$tarr["tm_wday"]],
$mon[$tarr["tm_mon"]],
(int)$tarr["tm_mday"],
((int)$tarr["tm_year"] + 1900) );
}
break;
}
}
$mybox .= "</select>\n";
return $mybox;
}
?>