Outline ·
[ Standard ] ·
Linear+
PHP calling database value into drop down menu in PHP, how to??
|
TSCooShyRee
|
Apr 10 2008, 02:36 PM, updated 18y ago
|
|
wat im gonna ask might sound simple, n i bet it is.. im a noob in php, so 4give the simpleness of my query here  i juz wanna ask, how do we call a database value to put it as an option in a drop down menu?? u see, the form is asking a user to input a specific classroom name, n i already have a database of the class names.. i wanna call those class names n put it into the options in the drop down menu.. simple as that.. it would be a major help if somebody would tell me the solution 2 this prob of mine.. been trying 4 few days already now.. thnx in advance This post has been edited by CooShyRee: Apr 10 2008, 02:41 PM
|
|
|
|
|
|
cyberfly
|
Apr 10 2008, 11:28 PM
|
|
QUOTE(CooShyRee @ Apr 10 2008, 02:36 PM) wat im gonna ask might sound simple, n i bet it is.. im a noob in php, so 4give the simpleness of my query here  i juz wanna ask, how do we call a database value to put it as an option in a drop down menu?? u see, the form is asking a user to input a specific classroom name, n i already have a database of the class names.. i wanna call those class names n put it into the options in the drop down menu.. simple as that.. it would be a major help if somebody would tell me the solution 2 this prob of mine.. been trying 4 few days already now.. thnx in advance  hi..do u do the manual coding or recordset from dreamweaver? CODE
<?php $sql = "select * from blok"; $dosql = mysql_query($sql) or die(mysql_error()); ?> <select name="blok" id="blok"> <?php while($arrayblok = mysql_fetch_array($dosql)){ ?> <option value="<?php echo $arrayblok['idBlok']; ?>"><?php echo $arrayblok['namaBlok']; ?></option> <?php } ?> </select>
|
|
|
|
|
|
TSCooShyRee
|
Apr 11 2008, 05:24 PM
|
|
QUOTE(cyberfly @ Apr 10 2008, 11:28 PM) hi..do u do the manual coding or recordset from dreamweaver? dreamweaver of coz.. still a beginner, so dreamweaver much easier.. anyway thnx!!
|
|
|
|
|