<HTML>
  <HEAD>
    <TITLE>SFDG Restaurant Voting - 1</TITLE>
  </HEAD>

  <BODY>
    <H1>SFDG Restaurant Voting - 1</H1>

    <P><STRONG>Note/Warning:</STRONG> When you vote, you
      <STRONG>email</STRONG>, <STRONG>choice</STRONG>, and the current
      <STRONG>time</STRONG> will be logged. This is partly to help me debug
      the system, and partly because I'm a packrat ;-)</P>

    <H2>Where should we meet on July 25 2002?</H2>

    <FORM ACTION="vote2.php">

      <P><INPUT TYPE="radio" name="choice" value="N">No choice, but save a
        seat for me!</INPUT></P>

<!--

      <INPUT TYPE="radio" name="choice" value="1">American
        Chopstick<BR /></INPUT>
      <INPUT TYPE="radio" name="choice" value="2">Applebee's<BR
        /></INPUT>
      <INPUT TYPE="radio" name="choice" value="3">Beijing
        Restaurant<BR /></INPUT>
      <INPUT TYPE="radio" name="choice" value="4">Bombay House (4th
        Street)<BR /></INPUT>

-->

      <?
        $db = mysql_pconnect("localhost","pannis","sampdb");

        if (!$db) {
          echo "Error: Couldn't connect to database. Please try again later.";
          exit;
        }

        mysql_select_db ("sfdgDb");

        $query = "select * from restaurant order by name";
        $result = mysql_query($query);
        $num_results = mysql_num_rows($result);
?>
<!--
echo "$query [" . $query . "]";
echo "$result [" . $result . "]";
echo "$num_results [" . $num_results . "]";
-->
<?
        for ($i = 0; $i < $num_results; $i++) {
          $row = mysql_fetch_array($result);
          echo "<INPUT TYPE='radio' name='choice' value='" . ($row["id"])
                . "'>" . htmlspecialchars(stripslashes($row["name"]))
                . "<BR /></INPUT>";
        }

      ?>

      <P>Your email address: <INPUT TYPE="text" name="email"/></P>

      <INPUT TYPE="submit" VALUE="Vote!"/>
    </FORM>

  </BODY>
</HTML>