PHP DROPDWON MENU

[php]<?php
//connecting to the database and running query

$dbc=mysqli_connect(‘localhost’,‘root’,’’,‘sam_telephone’);
$get_list_sql=“SELECT id, CONCAT_WS(’,’, l_name, f_name) AS display_name FROM
master_name;”;
$get_list_res= mysqli_query($dbc, $get_list_sql);
?>

--Select One-- <?php while($x=mysqli_fetch_array($get_list_res,MYSQLI_BOTH)){ ?> <?php echo $x['display_name']?> <?php } ?> <?php // this portion is not working what i want to do its to get the id, because if //I can get the id, i can run the query and get the result which i want to get // from this table if(isset($_POST['sel_id'])){ $safe_id = mysqli_real_escape_string($dbc, $_POST['sel_id']) or die(mysqli_error($dbc)); echo $safe_id; } ?>

[/php]

it’s like telephone directory, in drop down menu, its show the people who are in the data table.
what i want to do is to select the people from drop down menu and when i click on the submit button, it should show me the result for that particular person

Try removed the name from the options value, it’s not needed…

Change:
[php]<?php echo $x['display_name']?>[/php]

To:

[php]<?php echo $x['display_name']?>[/php]

Thank you very much, yah its working

Sponsor our Newsletter | Privacy Policy | Terms of Service