I have question related to this thread. I have the code below:
<?
$hostname="localhost";
$username="someone";
$password="somepwd";
$database="dbname";
$connection = mysql_connect($hostname, $username, $password) or die(mysql_error()."<b>Unable to Connect to the Server");
mysql_select_db($database,$connection) or die(mysql_error()."<b>Unable to Connect to the Database!</b>");
$mysql_dropdown_query = "select employee_id,first_name,last_name from personnel where is_active=1";
$dropdown_result = mysql_query($mysql_dropdown_query);
echo '<select name="EmpList" size="1">';
echo '<option value=\"\"></option>';
while ($row = mysql_fetch_row($dropdown_result))
{
echo '<option value=".$row[0].">".$row[1]." ".$row[2]."</option>\n';
};
echo '</select>';
mysql_close();
?>
My problem is that instead of listing the data from database, it lists the part between <option></option> which looks more like this:
".$row[1]."".$row[2]"
".$row[1]."".$row[2]"
".$row[1]."".$row[2]"
".$row[1]."".$row[2]"
".$row[1]."".$row[2]"
....
What I want to show in the dropdown list is the concatenate of First Name and Last Name which are in two separate column in Personnel Table. I also want that when someone select one from the list, it will pass a value of the employee_id.
I will really appreciate if someone can show me what's wrong with the code that I have which does not show the result as I want.
I have been trying with all the code I found from the forum. But, the result is still the same 😕
Thank you in advance.