# PHP if/else

**URL:** <https://forum.kirupa.com/t/php-if-else/241055>\
**Category:** programming\
**Created:** [October 9, 2007, 6:35pm UTC](https://forum.kirupa.com/t/php-if-else/241055 "2007-10-09T18:35:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![arca](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@arca](https://forum.kirupa.com/u/arca)\
**Post date:** [October 9, 2007, 6:35pm UTC](https://forum.kirupa.com/t/php-if-else/241055/1 "2007-10-09T18:35:05Z")

</div>

How do I get a radio button in 1 group to be checked when a radio button in another group becomes checked?  
For example: I want the button in var1 w/value “No voice” to become automatically selected when button var2 w/value “$39.99” is selected.  
\<input type=“radio” name=“var1” value="$39.99 More" checked=“checked”\>  
\<input type=“radio” name=“var1” value=“No voice”\>  
\<input type=“radio” name=“var2” value="$29.99" checked=“checked”\>  
\<input type=“radio” name=“var2” value="$39.99"\>

Is using if/else statements the right way? Would I also create more php if/else statements for other radio button scenarios?  
Thanks for any help on this.
