Hi guys,

I am trying to get my form to remember the value of the radio buttons during validation.

Is there a more efficient way of checking the radio button that was originally selected?

I am storing the selection in a session upon submission of the form.

PHP Code:
  <?
    
    
if     ($_SESSION['gender'] == 'male'
        {
        
        
?>
   
      <tr><td valign="center">Gender:</td>
       <td valign="center"><input type="radio" name="gender" class="radio" value="male" style="background:none; border:none;" checked="checked" />male &nbsp;
    <input type="radio" name="gender" class="radio" value="female" style="background:none; border:none;" />female</td></tr>
          
   <?
   
        
   
} elseif ($_SESSION['gender'] == 'female'
    {
    
    
    
?>
   
      <tr><td valign="center">Gender:</td>
       <td valign="center"><input type="radio" name="gender" class="radio" value="male" style="background:none; border:none;" />male &nbsp;
    <input type="radio" name="gender" class="radio" value="female" style="background:none; border:none;" checked="checked" />female</td></tr>
          
   <?
   
    
    
} elseif ($_SESSION['gender'] == ''
    {
    
    
?>
   
      <tr><td valign="center">Gender:</td>
       <td valign="center"><input type="radio" name="gender" class="radio" value="male" style="background:none; border:none;" />male &nbsp;
    <input type="radio" name="gender" class="radio" value="female" style="background:none; border:none;" />female</td></tr>
          
   <?
    
    
}
    
?>