Welcome Guest, Not a member yet? Register   Sign In
Call to undefined function form_input in CI 1.6
#1

[eluser]snurb[/eluser]
I followed a godbit tutorial (registration form) using ci 1.6 and it produces a fatal error. it says i'm calling an undefined function form_input. i tried the tutorial using 1.5.4 and there was no error.
#2

[eluser]Pascal Kriete[/eluser]
form_input still exists in 1.6 and I'm not aware of any changes made to it. Would you mind posting a reduced version of your code.
#3

[eluser]snurb[/eluser]
This is the controller:

Code:
class Form extends Controller {
  function index() {
    #Input and textarea feld attributes
    $data['fname'] = array('name' => 'fname', 'id' => 'fname');
    $data['email'] = array('name' => 'email', 'id' => 'email');
    $data['comments'] = array('name' => 'comments', 'id' => 'comments', 'rows' => 3, 'cols' => 40);
    
    #Checkbox attributes
    $data['purpose'] = array('name' => 'seminar[]', 'id' => 'purpose', 'value' => 'Purpose of Prayer', 'checked' => FALSE);
    $data['prepare'] = array('name' => 'seminar[]', 'id' => 'prepare', 'value' => 'Prepare for Prayer', 'checked' => FALSE);
    $data['principles'] = array('name' => 'seminar[]', 'id' => 'principles', 'value' => 'Principles of Prayer', 'checked' => FALSE);
    $data['power'] = array('name' => 'seminar[]', 'id' => 'power', 'value' => 'Power in Prayer', 'checked' => FALSE);
    $data['form_action'] = $this->config->site_url().'?c=form&m=submit';
    $this->load->view('form_view', $data);
  }
}

and a snippet of the view:

Code:
<body>
  <h1>Registration Form</h1>
  <p>Please complete the following form:</p>
  &lt;form method="post" action="&lt;?php echo $form_action; ?&gt;"&gt;
  <p><label for="fname">Full Name: </label><br />&lt;?php echo form_input($fname); ?&gt;</p>
  <p><label for="email">E-mail: </label><br />&lt;?php echo form_input($email); ?&gt;</p>
  <p>Please select one or more seminars, that you would like to attend</p>
  <p>&lt;?php echo form_checkbox($purpose); ?&gt; <label for="purpose">Purpose of Prayer</label></p>
  <p>&lt;?php echo form_checkbox($prepare); ?&gt; <label for="prepare">Prepare for Prayer</label></p>
  <p>&lt;?php echo form_checkbox($principles); ?&gt; <label for="principles">Principles of Prayer</label></p>
  <p>&lt;?php echo form_checkbox($power); ?&gt; <label for="power">Power in Prayer</label></p>
  <p><label for="comments">Comments: </label><br />&lt;?php echo form_textarea($comments); ?&gt;</p>

its from godbit tutorial.
#4

[eluser]tonanbarbarian[/eluser]
you need to load the form helpers before you can use form_input
i suugest in the controller somewhere before the load->view
som people might suggest in the autoload but i prefer not to so that you only load it if you need it
#5

[eluser]snurb[/eluser]
your right. thanks for taking the time.




Theme © iAndrew 2016 - Forum software by © MyBB