phpformscodeignitercontrollerhelper

CodeIgniter helper inside controllers


can i call helper functions inside controller classes?

let's say i have this controller with the _open_form method

class User extends Controller {
 function _open_form($action){
  print_r(form_open($action));
 }
}

i tried echoing out the result of form_open() but it returns null. it seems that helper functions can't be called inside controllers

if your wondering why i need to use it inside the controller instead in the view because we are required to use the given template parser xD


Solution

  • I figured it out. It seems that the view file did not escaped the result of form_open().

    try using

    htmlentities(form_open($action));
    

    it should escape < and > symbols.