if ($_POST)
{
	
	echo "You chose ", $_POST; 

}

else

{
	
	$families = array ("Peter Griffin","Lois Griffin","Chris Griffin","Meg Griffin","Stewie Griffin") ;
   
echo '<form name="families" method="post" action="index.php"><select name="family">';

foreach ($families as $family)
{
	
	echo '<option value="' . $family . '">' . $family . '</option>';

}

echo '<input type="submit">' ;

echo '</select></form>' ;

}

so what's the problem? this works fine

All you need to do is change $_POST to $_POST.

i don't understand the question, there's no problem populating the dropdown menu, i assume you mean how to echo the selected items from the dropdown menu? if that's the case then above post is right, change $_POST to $_POST

All you need to do is change $_POST to $_POST.

I did that and now it just brings me back to the dropdown menu after I click submit.

You guys were a big help in me solving this minor issue. Instead of

echo $_POST['family'] ;

Its supposed to be

echo $POST['families'] ;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.