<?php
// To make use of the class pls replace
// In the main.php
// 1. <tablename> with the table name in which the values are there
// 2. <fieldname> with the fieldname which has the values to be populated in the <select>
// 3. <default selected value.. if any> with any value in the table that u wish shold come on top
// of the list.
// In the class.pop.php
// 1. <hostname> with the host name of your server.
// 2. <username> with the user name of your server if any.
// 3. <password> with the pass name of your server if any.
// 4. <database name> with the database name.
// Include the class.
include "class.pop.php";
// Pass tablename, fieldname and value to be shown selected, if any.
// It is assumed that the third argument is there in the table as a record.
// If you don't want any specific value to come on top of the list then
// don't pass any third argument.
$try=new populate_sel("<tablename>","<fieldname>","<default selected value.. if any>");
echo "<html><body>";
echo "<form>";
echo "<select>";
$try->display();
echo "</select>";
echo "</form>";
echo "</body></html>";
?> |