Call to undefined form_open() error

#1
[eluser]01010011[/eluser]
Hi,

I am getting this error message:

Quote:Fatal error: Call to undefined function form_open() in C:\xampp\htdocs\myfile\system\application\views\signup_form.php on line 13

while using this code:

Code:
<!DOCTYPE html>
&lt;html lang="en"&gt;
&lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
    &lt;title&gt;Signup Form&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

<div id="signup_form">

    <p class="heading">New User Signup</p>

    &lt;?php echo form_open('signup/submit'); ?&gt;

    <p>
        <label for="username">Username: </label>
        &lt;?php echo form_input('username'); ?&gt;
    </p>
    <p>
        <label for="password">Password: </label>
        &lt;?php echo form_password('password'); ?&gt;
    </p>
    <p>
        <label for="passconf">Confirm Password: </label>
        &lt;?php echo form_password('passconf'); ?&gt;
    </p>
    <p>
        <label for="email">E-mail: </label>
        &lt;?php echo form_input('email'); ?&gt;
    </p>
    <p>
        &lt;?php echo form_submit('submit','Create my account'); ?&gt;
    </p>

    &lt;?php echo form_close(); ?&gt;
</div>

&lt;/body&gt;
&lt;/html&gt;
Code:
&lt;?php

class Signup extends Controller {

    public function __construct() {
        parent::Controller();

        $this->load->helper(array('form','url'));
        $this->load->library('form_validation');
    }

    public function index() {
        $this->load->view('signup_form');
    }

}

Any ideas what could be causing this?

#2
[eluser]Jelmer[/eluser]
Only thing I can think of is that you're possibly using PHP4 that doesn't recognize __construct() as the autoloader and as such the helpers weren't loaded.

#3
[eluser]01010011[/eluser]
[quote author="Jelmer" date="1271787709"]Only thing I can think of is that you're possibly using PHP4 that doesn't recognize __construct() as the autoloader and as such the helpers weren't loaded.[/quote]

Thanks for your reply Jelmer, it helped me figure out a solution around this problem.

I'm using XAMPP version 1.7.3 which has PHP 5.3.1.

It worked when I used "Classname()" instead of "_construct()". Why does it not work with _construct()? Anyway its working now. Thanks.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.