<HTML>
  <HEAD>
    <TITLE>Restaurant Voting</TITLE>
  </HEAD>

  <BODY>
    <H1>Restaurant Voting</H1>

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

    <FORM ACTION="vote.php">

<!--

      <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";
        $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>