Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- The user interface for <?php echo $_POST["name"]; ?><br>
- <?php
- // Connecting, selecting database
- $dbconn = pg_connect("host=*** dbname=*** user=*** password=***")
- or die('Could not connect: ' . pg_last_error());
- // Query for Course Information (for the drop-down box)
- $query = 'SELECT * FROM courseinformation';
- $result = pg_query($query) or die('Query failed: ' . pg_last_error());
- // Initialize the drop-down list (html-code)
- echo "<p>Drop-down list:</p><br>";
- echo "<select name="formCourse">";
- echo " <option value="">Select Course</option>";
- // Create the items in the drop-down list
- while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
- echo "<option value="foo">$line[0]</option>";
- }
- // End the drop-down list
- echo "</select>";
- echo "</p>";
- // Free resultset
- pg_free_result($result);
- // Closing connection
- pg_close($dbconn);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement