Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <?php include "head.php";?>
- </head>
- <body>
- <?php include "navBar.php";?>
- <form action="addPrato.php" method="post">
- <h3>Escolha ID do Leilão a concorrer</h3>
- <p>Leilão:
- <select name="prato_alimento">
- <?php
- try{
- $host = "db.ist.utl.pt";
- $user ="ist166983";
- $password = "rrdu5980";
- $dbname = $user;
- $db = new PDO("mysql:host=$host;dbname=$dbname", $user, $password);
- $sql = "SELECT l.nif, l.dia, l.nrleilaonodia FROM leilao as l;";
- $result = $db->query($sql);
- foreach($result as $row){
- //$alimento_name = $row['nif'];
- $alimento_name = $row['nif'];
- $alimento_name1 = $row['dia'];
- $alimento_name2 = $row['nrleilaonodia '];
- echo("<option value=\"$alimento_name\">$alimento_name</option>\n"+"<option value=\"$alimento_name1\">$alimento_name1</option>\n"+"<option value=\"$alimento_name2\">$alimento_name2</option>\n");
- }
- $db = null;
- }catch (PDOException $e){
- echo("<p>ERROR: {$e->getMessage()}<p/>");
- }
- ?>
- </select>
- </p>
- <p><input type="submit" value="Submit"/></p>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement