jcbodyworks
asked on
PHP While Loop drop down menu problem
I have this problem with a while loop that keeps returning the first initial of someone's name when it runs. I want the full name. The loop is designed to create a drop down list that works fine, except for this stupid inconsistency. I checked the database, and the full name is definitely there. The last name comes out fine, so I dont know where the problem is. Here is the code:
$resulttwo=mysql_query("SE LECT * FROM employees WHERE empnum>=1 ORDER BY firstname ASC") or die(mysql_error());
$displayth ='<select name="th" id="th">';
$p=0;
while ($rowtwo=mysql_fetch_array ($resulttw o))
{
$empid[$p]=$rowtwo['employ eeid'];
$firstname[$p]=$rowtwo['fi rstname'];
$lastname[$p]=$rowtwo['las tname'];
$displayth .='<option value="' . $empid[$p] . '">' . $firstname[$p] . " " . $lastname[$p] . '</option>';
$displayth .= '</font><font size="2" face="Eras Demi ITC">';
$p++;
}
$displayth .='</select>';
echo $displayth;
$resulttwo=mysql_query("SE
$displayth ='<select name="th" id="th">';
$p=0;
while ($rowtwo=mysql_fetch_array
{
$empid[$p]=$rowtwo['employ
$firstname[$p]=$rowtwo['fi
$lastname[$p]=$rowtwo['las
$displayth .='<option value="' . $empid[$p] . '">' . $firstname[$p] . " " . $lastname[$p] . '</option>';
$displayth .= '</font><font size="2" face="Eras Demi ITC">';
$p++;
}
$displayth .='</select>';
echo $displayth;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hey, good job! Thanks for the points, and good luck.
ASKER
$firstname=$_SESSION['firs
this was causing the problem. I changed the variable, so now everything works like a charm! Thank you!