Hello,
I am learning codeigniter
So I have 3 radio button. My code as under

View Page

<li id="AgencyType" style="z-index: 93;">
        <label class="mandatory" for="ExternalAgency">Are you an employment agency?</label>

        <ul>
            <li style="z-index: 92;">
                <?php 
                    $data = array(
                            'id'=>'ExternalAgency',
                            'name'=>'ExternalAgency',
                    );
                    echo form_radio($data);?>

                <label for="ExternalAgency">No, we recruit directly.</label>
            </li>

            <li style="z-index: 91;">
                <?php 
                    $data = array('id'=>'HeadhuntingAgency',
                                'name'=>'ExternalAgency');
                    echo form_radio($data); ?>

                <label for="HeadhuntingAgency">Yes, we are a headhunting/recruitment agency.</label>
            </li>

            <li style="z-index: 90;">

                <?php $data = array('id'=>'TemporaryAgency',
                            'name'=>'ExternalAgency'); 
                echo form_radio($data); ?>

                <label for="TemporaryAgency">Yes, we are a temporary staffing agency.</label>
            </li>

            <?php echo form_error('ExternalAgency','<span style="color:red;float:none;">','</span>'); ?>

    </ul>

Visula Output

27483aa56dc4de9c558b08cc6a2d978e

Problem:
If No One can selected then given me Error message.

Given me suggestion

Thank you

Member Avatar for iamthwee

use form validation

i have used form validation in my controller

$this->form_validation->set_rules('ExternalAgency','Select one','required');

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.