Hello all,

I am very new to PHP but am struggling to learn. I have created a submit form for my school website, and in the form I have a group of radio buttons. See below:

HTML Code:
*Account Fund: <input type="radio" name="accfnd" value="nonprofit" <?php echo $nonprofitChecked; ?> >Academic/Non-Profit <input type="radio" name="accfnd" value="commercial" <?php echo $commercialChecked; ?> >Commercial <input type="radio" name="accfnd" value="uc" <?php echo $ucChecked; ?>>UC  <input type="text" size="40" name="ucfund" value="<?php if(isset($_POST['ucfund'])) echo $_POST['ucfund'];?>" />
<?php if($ucfundError != '') { ?>
                <span class="error">
                <?=$ucfundError;?>
                </span>
                <?php } ?>
When the radio button with the value="uc" is checked, the text box next to it is required to be filled out otherwise they will get an error message. For the most part this is working fine, what I am having problem with is that I am getting the error message requiring the text message be filled even though I have one of the other radio buttons checked. The only time the text box is required is when the "uc" radio button is checked. I hope I am making sense.

Below are the php codes. I would appreciate any help. Thank you.

PHP Code:
// account fund
    
$accfnd $_POST['accfnd'];
    
    if (isset(
$_GET['uc'])){ 
    if (
$_GET['accfnd'] == 'uc'){ $ucChecked ' checked="checked" '; } 
   
    } else if (
trim($_POST['ucfund']) === '') {
        
$ucfundError '<span class="error">Account fund is required for UCI users.</span>';
        
$hasError true;
    } else {
        
$ucfund trim($_POST['ucfund']);
    } 
PHP Code:
$body " Account Fund: $accfnd \n\n UCI Account Fund: $ucfund"