Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter edit checkbox showing error
#1

[font=Arial,]My code is : [/font]
                                        <label class="checkbox-inline">

                                          <input type="checkbox" name="Stake_Holder" value="Stake_Holder" <?php if($data['Stake_Holder'] == 'Stake_Holder'){echo 'checked';}?>/>Stake Holder
                                        </label>
///////////////////////////////////////////////////////////////////////

[font=Arial,]Error showing: A PHP Error was encountered Severity: Notice[/font]
Message: Undefined variable: data
Filename: superadmin/client_view.php
Line Number: 73
Backtrace:
File: C:\xampp\htdocs\ciall\ciautomation\application\views\superadmin\client_view.php Line: 73 Function: _error_handler
File: C:\xampp\htdocs\ciall\ciautomation\application\controllers\Client_con.php Line: 37 Function: view
File: C:\xampp\htdocs\ciall\ciautomation\index.php Line: 315 Function: require_once
/>Stake Holder

I want echo checked
Reply
#2

Without see your controller code I would say that $data['Stake_Holder'] should be $Stake_Holder
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Check that you've passed $data in the view:

PHP Code:
$this->load->view('viewfile', ['data' => $data]); 
Reply
#4

<input type="checkbox" name="accept_terms_checkbox" value="Accept TOS" <?php echo set_checkbox('accept_terms_checkbox', 'Accept TOS'); ?> /> Accept Terms of Services

<input type="checkbox" name="M0140" value="1"  <?php echo ($result->M0140== "1" ) ? "checked" : set_checkbox('M0140, '1',$result->M0140== "1"); ?> size="1">

I think you have to try this...
Reply




Theme © iAndrew 2016 - Forum software by © MyBB