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 difference between core php and framework?

466


Can I run php without xampp?

507


What are the differences between mysqli_connect and mysqli_pconnect?

539


What is a php certification?

501


How to create a session? How to remove data from a session?

528






How do I run a php script in windows?

558


Is php good for career?

560


Which programming language does php resemble to?

551


What is the use of 'print' in php?

554


What is the difference between md5(), crc32() and sha1() crypto on php?

623


What is alias in php?

557


How many keywords are there in php?

627


What is php and why it is used?

555


What is meant by pdo in php?

554


In PHP, fgets() is used to read a file one line at a time. State Whether True or False?

587