which are the reserve dates and the email address associated2000:4:2 email@foo 2000:4:5 email@foo 2000:4:15 email@foo 2000:4:24 email@foo
#!/usr/bin/perl use CGI qw(:standard); use Date::Calc qw(:all); print header(); print start_html(); &print_calender(4, 2000); print end_html(); sub print_calender { my $month = shift; my $year = shift; my %res; open(RES, "reserve.dat")||die; while(($date,$email) = split(/\s/, <RES>)) { $res{$date} = $email; } print "<center>\n"; print start_form(), "\n"; print "<table width=$tableWidth BORDER=1 VALIGN=\"MIDDLE\">\n"; print "<tr align=\"center\">", "\n"; $dow = 7; for($i=1; $i<=7; $i++) { print "<td width=$width>", b(Day_of_Week_to_Text($dow)), "</td +>\n"; $dow = $dow %7 + 1; } print "</tr>\n"; $day = 1; while(check_date($year, $month, $day)) { $weekday = Day_of_Week($year, $month, $day); $weekday = $weekday % 7 + 1; print "<tr>\n"; for($j=1;$j<$weekday;$j++) { print "<td width=$width height=$height>", br, "</td>", "\n +"; } for($j=$weekday;$j<8;$j++) { if(check_date($year, $month, $day)) { print "<td width=$width height=$height valign=\"TOP\"> +", "\n"; print b($day), br, "\n"; unless( $res{"$year:$month:$day"} =~ /\S/ ) { print checkbox(-name=>"$year:$month:$day", -label= +>"Reserve"); } print "</td>", "\n"; $day++; } else { print "<td width=$width height=$height>", br, "</td>", + "\n"; } } print "</tr>", "\n"; } print "</table>\n"; print "Email Address: ", textfield(-name=>'email'), br; print submit(-name=>'Make Reservation'); print "</form>\n"; print "</center>\n"; }
In reply to Re: CGI Calandar
by perlmonkey
in thread CGI Calandar
by raflach
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |