firstly, you are looping through the mysql resultset - each time you loop, you overwrite the variable $select_artist. amend this by making it .=
$select_artist = "";
while ($row = mysql_fetch_array($result))
{
$select_artist .= "<option value='".$row['artist']."'>".$row['artist']."</option>";
}
second, you may want to look at output buffering in the php manual. Output buffering captures all the output, ie
ob_start(); // start buffering
echo "This will go into the buffer"; // echos will go into buffer
echo "Which will then be put into the variable";
$output = ob_get_contents(); // put the buffered data into $output
ob_flush(); // end the buffer
hope that helps
adam