Can you use more variables?
$form = "Your initial HTML";
$states = "";
foreach ($states as $state) {
$states .= "<option value='" . $state['state_name'] . "'>"
. $state['state_name'] . "</option>";
}
$form .= $states;
$form .= "the rest of your HTML";
If you are explicitly trying to keep it all in one variable, feel free to update your question to reflect that.