Take this code;
echo '<select name="name">';
while ($row = mysql_fetch_assoc($result))
{
echo '<option>' . $row['name'] . '</option>';
}
echo '</select>';
and change it to
session_start();
while ($row = mysql_fetch_assoc($result))
{
$_SESSION['name'][]= $row['name'] ;
header("nextpage.php");
}
Then create a new page called nextpage.php that looks like this
<?php
session_start();
print_r($_SESSION['name']);
?>
Then run the script and when the database has processed the data it will go to nextpage.php and print out all the values of $_SESSION['name'}.