I am making a drop down menu that is populated using an sql database. Using the popDropDown function below, I am taking in all the needed data and creating the needed HTML for the dynamic population.
Here's the rub... I am having a tough time returning the selected email address. I realize that the POST stuff isn't documented here that will process my request. I would like to know if there is any way to return the email address that has been selected by the user using the drop down. The end result will use the returned address + a subject and message to generate an email.
What have I forgotten to mention? Thanks is advance.
$emailAd = popDropDown($results);
function popDropDown($results){
$_email="";
while($row=$results->fetch_assoc())
{
$email=$row['EmailAddress'];
$id=$row['id'];
$Name=$row['MemberName'];
//echo $email."<br>";
if ($_POST['emailMenu']==$id)
{
echo '<option value="'.$id.'"selected>'.$email."</option>";
$_email=$email;
}
else
echo '<option value="'.$id.'">'.$email."</option>";
}
return $_email;
}