![]() |
disable/hide button using condition in controller - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: disable/hide button using condition in controller (/showthread.php?tid=71136) |
disable/hide button using condition in controller - kvanaraj - 07-10-2018 how to disable.hide one submit button (Register) in the controller My query should be like this $query = $this->db->query("select count(*) as cnt from student where brcode=$brdata and sem=$semester and inst_code=$inst_code"); $row = $query-> row_array (); $max_id = $row ['cnt']; $max_id1 = (int) ($max_id); $cntt = $max_id1; if ( $cntt > 0 ) { Disable button Register how? } else { enable button Register } RE: disable/hide button using condition in controller - Pertti - 07-10-2018 If you are not already using views, you should consider it, but here's a simple example how to pass data to view and then in view display different HTML, depending on values. Controller: PHP Code: public function index() View file: PHP Code: <h1><?= $pageTitle ?></h1> |