Advertisement
Guest User

Untitled

a guest
Mar 1st, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <html>
  2. <body>
  3. The user interface for <?php echo $_POST["name"]; ?><br>
  4.  
  5. <?php
  6. // Connecting, selecting database
  7. $dbconn = pg_connect("host=*** dbname=*** user=*** password=***")
  8. or die('Could not connect: ' . pg_last_error());
  9.  
  10. // Query for Course Information (for the drop-down box)
  11. $query = 'SELECT * FROM courseinformation';
  12. $result = pg_query($query) or die('Query failed: ' . pg_last_error());
  13.  
  14. // Initialize the drop-down list (html-code)
  15. echo "<p>Drop-down list:</p><br>";
  16. echo "<select name="formCourse">";
  17. echo " <option value="">Select Course</option>";
  18.  
  19. // Create the items in the drop-down list
  20. while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
  21. echo "<option value="foo">$line[0]</option>";
  22. }
  23.  
  24. // End the drop-down list
  25. echo "</select>";
  26. echo "</p>";
  27.  
  28. // Free resultset
  29. pg_free_result($result);
  30.  
  31. // Closing connection
  32. pg_close($dbconn);
  33. ?>
  34.  
  35. </body>
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement