So, I'm having some issues with calling two fields from a table and inputting them as one entry in a select box that will keep adding each entry in a while statement. In simpler terms I have one field called firstname and the next lastname in a table called professors. I need these fields combined and put together and each one inputted into a select box. Below is the code I have and I receive errors in dreamweaver at the bottom part when I start the while statement, so I know what I have isn't working but I'm having trouble figuring out why. I can't upload a picture with syntax highlighting because I just made my account and don't have enough reputation. The parts of code that I'm only concerned with in this question are the beginning parts up to where I start the table, and down at the bottom where I declare the select box for professor and the loop to grab the first and last names that are in the table. I've been reading many support solutions for similar problems but was unsuccessful. If anyone has any tips or advice I'd be greatful.
$fprofessor = $_GET['p_firstname'];
$lprofessor = $_GET['p_lastname'];
$selected_professor=$fprofessor." ".$lprofessor;
$qp = "SELECT p_id, p_firstname, p_lastname FROM professors WHERE p_firstname='$fprofessor' AND p_lastname='$lprofessor'";
$rp = @mysqli_query($dbc, $qp);
// Table header:
echo '<table align="center" cellspacing="0" cellpadding="5" width="auto">
<tr bgcolor="' . $bg . '">
<td align="left">Section ID</td>
<td align="left">Course Major</td>
<td align="left">Course ID</td>
<td align="left">Course Name</td>
</tr>
<tr bgcolor="' . $bg . '">
<form action="add_courses.php" method="post">
<td align="left"><input type="text" name="section_id" size="7" maxlength="7"/></td>
<td align="left"><select name="course_major">
<option value="TBA">-Select Major-</option>
<option value="CIT">CIT</option>
<option value="CSE">CSE</option>
<option value="CIT/CSE">CIT/CSE</option></td>
<td align="left"><input type="text" name="course_id" size="3" maxlength="3"/></td>
<td align="left"><input type="text" name="course_name" size="15" maxlength="25"/></td>
</tr>
<tr bgcolor="' . $bg . '">
<td align="left">Professor</td>
<td align="left">Available</td>
<td align="left">Semester</td>
<td align="left">Year</td>
</tr>
<tr bgcolor="' . $bg . '">
<td align="left"><select name="course_professor">
<option value="TBA">-Select Professor-</option>'
while ($row = mysqli_fetch_array ($rp, MYSQLI_NUM)) {
echo'<option value="'.$row[. $selected_professor .].'">'.$row[. $selected_professor .].'</option>'
};
echo'</td>
So, I've revised the code to something that seems more fitting based on the suggestions I got. Below is what I have now but I'm still receiving an error on the $qp variable and the while statement in this code
<td align="left"><select name="course_professor">'
$qp = "SELECT p_id, p_firstname, p_lastname, CONCAT(p_firstname, p_lastname) AS p_fullname FROM professors";
$rp = @mysqli_query($dbc, $qp);
echo '<option value="TBA">-Select Professor-</option>'
while ($row = mysqli_fetch_array ($rp)) {
echo '<option value="'.$row['p_fullname'].'">'.$row['p_fullname'].'</option>'
};
echo'</td>