如何将变量值赋给单选按钮

My code looks like that:

foreach($options as $option) {

?>

<input type="radio" name="option" value=<?php $option ?>><?php echo $option?><br>


<?php }?>

<input name= "submit" type="submit" value="Vasta">
</form>

But it does not give the result I want. How could I give radio buttons value of variable $option? This question might have to little information about problem, if it is necessary i post more of my code.

When I change value=<?php $option ?> to value='dog' everything works the way I want, the value will be given.

You're missing your echo statement. I also suspect you have spaces in your values which breaks your HTML because you are not using quotes around those values:

<input type="radio" name="option" value="<?php echo $option ?>"><?php echo $option?><br>

Try using

value="<?php echo $option ?>">