![]() |
want to call a function through a button php - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1) +--- Forum: Lounge (https://forum.codeigniter.com/forumdisplay.php?fid=3) +--- Thread: want to call a function through a button php (/showthread.php?tid=71595) |
want to call a function through a button php - kvanaraj - 09-02-2018 echo "<a href='".base_url()."' class='btn btn-sm float-left btn-info'> < - Go Back</a>"; controller name :users function name : logout RE: want to call a function through a button php - Pertti - 09-03-2018 base_url is for direct file assets like JS or CSS or images, for linking to CodeIgniter controller/method where URL might be rewritten with index.php prefix, or without, you should use site_url helper function, in this case site_url('users/logout') RE: want to call a function through a button php - Wouter60 - 09-03-2018 Please, take some time (maybe several days) to read the CodeIgniter documentation. Without doing that, it will cost you twice the time (or more) to solve all the issues you will encounter, because you're missing so many basics. Like making a hyperlink (button or not) refer to a controller/function: PHP Code: <?php echo anchor('users/logout', ' <- Go back ', 'class="btn btn-sm btn-info float-left"');?> You must (auto)load the url helper if you want to use the anchor() function. RE: want to call a function through a button php - Leo - 09-03-2018 erm if you are new don't get in the habit of "<?php echo" "<?=" is so much cleaner instead ![]() RE: want to call a function through a button php - kvanaraj - 09-06-2018 (09-03-2018, 01:10 PM)Wouter60 Wrote: Please, take some time (maybe several days) to read the CodeIgniter documentation. Without doing that, it will cost you twice the time (or more) to solve all the issues you will encounter, because you're missing so many basics.How to pass parameter to the function using anchor RE: want to call a function through a button php - Wouter60 - 09-07-2018 All the information you need is here: https://www.codeigniter.com/userguide3/general/urls.html Combined with: https://www.codeigniter.com/userguide3/helpers/url_helper.html?highlight=anchor#anchor RE: want to call a function through a button php - kvanaraj - 09-07-2018 (09-07-2018, 12:22 AM)Wouter60 Wrote: All the information you need is here: Thanks for your support. I solve that issue. |