Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic dropdown lists please help

Status
Not open for further replies.

willya340

Technical User
Jul 2, 2001
17
KW
I tried to implement it but the lists don`t get populated !!!
Maybe because its built for ultradev and not Dreamweaver MX , and maybe its
using an ASP , i want to use PHP and MySQL to populate the dropdownlists ,
any help please , thanks ?!!

I want to implement the tutorial in this macromedia technote using
php/mysql/javascript.


anyone have any idea how to do that :D

Thanks
 
an eg:
<select name=&quot;numbers&quot;>
<?php
for($i=0;$i<10;$i++)
{
echo &quot;<option value='$i'>$i</option>&quot;;
}
?>
</select>



Known is handfull, Unknown is worldfull
 
I think you still need javascript to do it even if you use PHP (that is if you want a multiple dynamic list eg. 2 or more drop down list that is connected)

First you need to retrieve the values from MySQL ..

then loop through every mysql_fetch_array($result)


I did this for retrieving country/states
$sql = &quot;SELECT * from state&quot;;
$result = mysql_query($sql);

<select name=&quot;state&quot;>
<?php
if ($myrow = mysql_fetch_array($result))
{
do{
printf(&quot;<option value=\&quot;%s\&quot;>%s</option><br>\n&quot;, $myrow[&quot;state_id&quot;], $myrow[&quot;state&quot;]);
}
while($myrow = mysql_fetch_array($result));
}
?>
</select>


Regards,

Namida
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top