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>

            <li style="z-index: 92;">
                    $data = array(
                    echo form_radio($data);?>

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

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

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

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

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

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

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


Visula Output


If No One can selected then given me Error message.

Given me suggestion

Thank you

Recommended Answers

All 3 Replies

Member Avatar

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.