Forms
|
|
|
|
<?php function display_data($usertable,$fieldname) {
$db = new DB_local;
$queryst = "SELECT * FROM $usertable";
$result = $db->query($queryst);
$number = odbc_num_rows($result);
if( odbc_fetch_row($result, 1) ) {
do {
$var = odbc_result($result,"$fieldname");
print "<option value='$var'>$var</option><br>n";
} while ( odbc_fetch_row($result) );
} else {
print("No data in the record set");
}
}
?>
|
|
|
Usage Example
|
Put this into your html between <select>
</select> tags.
<? display_data('MyTableName','MyColumnName'); ?>
|
|
|
Rate This Script
|
|
|
|