I want to take 1 field in a mysql table and use that information to populate an html form select field instead of writing the html code, that way when data changes in that mysql field the form will always be in sync with the table?
You need to use a programming language like PHP. You would code a SELECT to retrieve your data and dump it into an array. Then use a PHP statement like:
echo FormSelect( 'field', $array, '22' );
Where: - 'field' is the name of field within form - $array contains values from database - 22 is default value, if any
function FormSelect( $name, $adata, $val ) { $str = '<select name="' . $name . '" size="1" >'; foreach($adata as $k=>$o) { $str .= '<option value="' . $k . '"'; if( "$k"=="$val" ) $str .= ' selected '; $str .= '>' . $o . '</option>' . "\n"; } $str .= "</select>"; return( $str ); }
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]