Yeah, there's two things you can do to get rid of this warning. What you said:
$smith = "";
if($submit == "button_a") {
$smith = "button_a";
}
elseif($submit == "button_b"){
$smith = "button_b";
}
Or check if it's set when you print it:
However, this is just a warning, and it is letting you know that there is a condition that $smith won't be defined (when $submit isn't "button_a" and isn't "button_b"). If that condition were to occur, you would be printing $smith when it wasn't set, which could be a bug in your script.