[eluser]orangeblossom[/eluser]
Yes...no problem. I was thinking there just may be a general solution to check these things by, which is why I put my question in that format. But, thanks for helping & here is the error & code:
The Error:
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant ‘signup_form’ - assumed '‘signup_form’'
Filename: controllers/login.php
Line Number: 64
An Error Was Encountered
Unable to load the requested file: ‘signup_form’.php
---------------------------------------------------------------------
This is the error line from the login.php (via controller):
$this->load->view(‘signup_form’); (line 64)
-------------------------------------------------------------------------
The login.php (via controller):
Code:
<?php
class Login extends CI_Controller {
function index()
{
$data['main_content'] = 'login_form';
$this->load->view('includes/template', $data);
}
function validate_credentials()
{
$this->load->model('membership_model');
$query = $this->membership_model->validate();
if($query) // if the user's credentials validate...
{
$data = array(
'username' => $this->input->post('username'),
'is_logged_in' => true
);
$this->session->set_userdata($data);
redirect('site/members_area');
}
else
{
$this->index();
}
}
function signup()
{
$data['main_content'] = 'signup_form';
$this->load->view('includes/template' , $data);
}
function create_member()
{
$this->load->library('form_validation');
//field name, error message, validation rules
$this->form_validation->set_rules('first_name' , 'Name' , 'trim|required');
$this->form_validation->set_rules('last_name' , ' Last Name' , 'trim|required');
$this->form_validation->set_rules('email_address' , 'Email Address' , 'trim|required|validemail');
$this->form_validation->set_rules('username' , 'Username' , 'trim|required|min_length[4]');
$this->form_validation->set_rules('password' , 'Password' , 'trim|required|min_length[4]|max_length[32]');
$this->form_validation->set_rules('password2' , 'Password Confirmation' , 'trim|required|matches[password]');
if($this->form_validation->run() == FALSE)
{
$this->signup();
}
else
{
$this->load->model('membership_model');
if($query = $this->membership_model->create_member())
{
$data['main_content'] = 'signup_successful';
$this->load->view('includes/template' , $data);
}
else
{
$this->load->view(‘signup_form’);
}
}
}
function logout()
{
$this->session->session_destroy();
$this->index();
}
}
------------------------------------------------------------------
The signup_form.php (via views):
Code:
<h1>Create an Account</h1>
<fieldset>
<legend>Personal Information</legend>
<?php
echo form_open('login/create_member');
echo form_input('first_name', set_value('first_name', 'First Name'));
echo form_input('last_name', set_value('last_name', 'Last Name'));
echo form_input('email_address', set_value('email_address', 'Email Address'));
?>
</fieldset>
<fieldset>
<legend>Login Info</legend>
<?php
echo form_input('username', set_value('username', 'Username'));
echo form_input('password', set_value('password', 'Password'));
echo form_input('password2', 'Password Confirm');
echo form_submit('submit', 'Create Account');
?>
<?php echo validation_errors('<p class="error">'); ?>
</fieldset>
------------------------------------------------------------------------------
Just in case: Here is signup_successful.php
Code:
<h1>Congrats</h1>
<p>Your account has been created. <?php echo anchor('Login' , 'Login Now'); ?></p>
--------------------------------------------------------------------------------
Just in case: login_form.php (from views)
Code:
<style type="text/css">
#login_form p {
color: #060;
text-align: center;
font-size: 20px;
}
</style>
<div id="login_form">
<h1>Page</h1>
<p>Client Management System</p>
<?php
echo form_open('login/validate_credentials');
echo form_input('username' , 'Username');
echo form_password('password' , 'Password');
echo form_submit('submit' , 'Login');
echo anchor('login/signup' , 'Not Registered?');
?>
</div>
---------------------------------------
I understand the error (Use of undefined constant ‘signup_form’ - assumed '‘signup_form’')
as if it can't connect, or there is no route to it, or it can't be found, or it doesn't exist.
I'm sure this problem will happen periodically. Therefore, I'm trying to learn steps to rectify this problem. The real lesson is in what to look for. Your stating it might just be quotes.
So:
1) Does the file exist? Yes. It is even directed right.
2) Check the line. Yes. All appears right.
3) Checked the entire code compared to others online. Yes, same.
4) Is it because I have newer CI, that some parts of code is wrong? hmmmmmm.
5) May I be missing a model or controller folder for it? I don't think so.
6) Could it be a quote or something simple? Yes...it happened to me yesterday.
Thank you so much!