Make a "dynamic drop down list" with using only PHP,HTML
and MySQL..

Answer Posted / sasmitamohanta

<select name="name">
<option value="">Select Name</option>
<?
// make connection to data base
mysql_connect('localhost','root','') ;

//select database
mysql_select_db('mail');

//select all da from 'table' say it ve two colom Id and Name
$sql=mysql_query("select * from table");

//select one by one row data s
while($r=mysql_assoc($sql))
{?>
<option value="<?=$r['Id'];?>"><?=$r['Name'];?></option>
<?}?>

Is This Answer Correct ?    5 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is design pattern? Explain all including singleton pattern?

529


How do I sort numbers in php?

532


What is composer phar?

496


Tell me what is pear?

549


Write syntax to open a file in php?

516






How to track user logged out or not? When user is idle?

505


What is the advantage of runtime polymorphism?

503


Difference between get and post method.

543


What is return in php function?

486


What is the purpose of the '.myd' file extension? What do thes file contain?

534


Which is better python or php?

556


Will php die?

520


What is faster in php?

574


What is difference between php and wordpress?

502


What is data abstraction in php?

574