hope you can help
I want to have a drop down list that searches my mysql database and shows the first and last names of the users. You can then select any of the names and it will generate the rest of the membership details (i.e. date signed up, last logged in etc).
I have got the dropdown list working fine, but my problem comes with the next step of generating the rest of the details. With my below code it just shows the details of the last user who signed up and does not change when I change the name in the drop down menu.
I'm pretty sure I need Javascript to help get this working but as I am a beginner to PHP/MYSQL any advise toward the right direction for me would be great. Thanks
This is the code which searches my database and puts the first and last name in to a drop down list
$sql = "SELECT first_name,last_name FROM registration_tbl";
$query = mysqli_query($dbc, $sql);
echo '<select name="name" style="width: 400px">';
while ($row = mysqli_fetch_assoc($query)){
$firstname = $row['first_name'];
$lastname = $row['last_name'];
echo'<option>' . $firstname . " " . $lastname . '</option>';
}
echo '</select> <p>';
Again the above code works fine, but the below code is what I am having difficulty with
$sql = "SELECT * FROM registration_tbl WHERE first_name = '".$firstname."'";
$query = mysqli_query($dbc, $sql);
while($row = mysqli_fetch_array($query)){
echo "ID: " . " " . $row[0] . "<br>" .
"Name: " . $row[1] . " " . $row[2] . "<br>" .
"Company: " . $row[3] . "<br> " .
"Email: " .$row[4] . "<br> " .
"Date of registration: " . $row[6] . "<br> " .
"Last login: " .$row[7] . "<br>" .
"Admin/User: " .$row[8] . "<p>";
}