Re: İnsert into drop down menu item from mysql db's table
Something like ...
// QUERY TO POPULATE LIST FROM FIRST COLUMN OF A QUERY
$result = mysql_query( "SELECT somevalue FROM ..." );
// EXISTING OR PRESET VALUE IF ANY
$var = "some preconfigured value";
// FORM POSTS TO URL
echo "<FORM name='XXX' action='URL' method='POST'>\n";
echo " <b>PROMPT TEXT:</b> \n <SELECT name='varname' onChange='submit()'>\n";
while( $row = mysql_fetch_row( $result )) {
$sel = ( $var === $row[0] ) ? "id='sel' selected" : "";
printf( " <option %s value='%s'>%s</option>\n", $sel, $row[0], $row[0] );
}
echo " </SELECT>\n";
PB
Subject
Written By
Posted
Re: İnsert into drop down menu item from mysql db's table
May 03, 2006 06:31AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.