Welcome Guest ( Log In | Register )

Bump Topic Topic Closed RSS Feed

Outline · [ Standard ] · Linear+

PHP calling database value into drop down menu in PHP, how to??

views
     
TSCooShyRee
post Apr 10 2008, 02:36 PM, updated 18y ago

The mad italian scorpions!!
*******
Senior Member
3,806 posts

Joined: Feb 2005
From: Isle of Man



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 sweat.gif

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 notworthy.gif

This post has been edited by CooShyRee: Apr 10 2008, 02:41 PM
cyberfly
post Apr 10 2008, 11:28 PM

Web Dev Zero to Hero
*****
Senior Member
706 posts

Joined: Dec 2006



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 sweat.gif

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 notworthy.gif
*
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
post Apr 11 2008, 05:24 PM

The mad italian scorpions!!
*******
Senior Member
3,806 posts

Joined: Feb 2005
From: Isle of Man



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!!

Topic ClosedOptions
 

Change to:
| Lo-Fi Version
0.0148sec    0.44    5 queries    GZIP Disabled
Time is now: 29th November 2025 - 07:11 PM