------------------------------------------------------------
Listing 6: add-appointment-form.html

<!-- -*- mmm-classes: mason -*- -->
<HTML>

<Head>
<Title>Add an appointment</Title>
</Head>

<Body>
<H1>Add an appointment</H1>

<form method="POST" action="add-appointment.html">

<P>Make an appointment with

<select name="email">

% # Iterate through the names and addresses, printing them out
% foreach my $info (@names_and_addresses) {
    <option value ="<% $info->[1] %>"><% $info->[0] %>
% }
                              
</select></P>

<P>on:

<select name="begin_month">
% foreach my $month (@months) {
    <option value="<% $month %>"><% $month %>
% }
</select>

<select name="begin_day">
% foreach my $day (1 .. 31) {
    <option value="<% $day %>"><% $day %>
% }
</select>
,

<select name="begin_year">
% foreach my $year (@years) {
    <option value="<% $year %>"><% $year %>
% }
</select>

at

<select name="begin_hour">
% foreach my $hour (0 .. 23) {
    <option value="<% $hour %>"><% $hour %>
% }
</select>

:

<select name="begin_minute">
% foreach my $minute ("00", 10, 20, 30, 40, 50) {
    <option value="<% $minute %>"><% $minute %>
% }
</select>

</P>

<P>until:

<select name="end_month">
% foreach my $month (@months) {
    <option value="<% $month %>"><% $month %>
% }
</select>

<select name="end_day">
% foreach my $day (1 .. 31) {
    <option value="<% $day %>"><% $day %>
% }
</select>
,

<select name="end_year">
% foreach my $year (@years) {
    <option value="<% $year %>"><% $year %>
% }
</select>

at

<select name="end_hour">
% foreach my $hour (0 .. 23) {
    <option value="<% $hour %>"><% $hour %>
% }
</select>

:

<select name="end_minute">
% foreach my $minute ("00", 10, 20, 30, 40, 50) {
    <option value="<% $minute %>"><% $minute %>
% }
</select>
</P>

<P>Text: <input type="text" name="notes" size="100"></P>

<P><input type="submit" value="Enter an appointment"></P>

</Form>

</Body>

</HTML>

<%once>
my @months = qw(January February March April May June July
                August September October November December);

my @years = (2001 .. 2004);
</%once>

<%init>
use People;
my $people = new People;

# Get all of the names of people, so that we can print them
my @names_and_addresses = $people->get_names_and_addresses();
</%init>
                                     
                                                                                               
