Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8296151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:52:31+00:00 2026-06-08T14:52:31+00:00

I am using CodeIgniter with Smarty. The problem I encountered is when using Form

  • 0

I am using CodeIgniter with Smarty. The problem I encountered is when using Form helper. I used the code found here.

So when I open and close the form tag actually using CI native form_open and form_close then after the form submission form_validation->run() is still always false.

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class User extends CI_Controller {

public function index()
{
    $this->register();
}

function register()
{
    $data['title'] = 'Register';
    $this->load->library('form_validation');
    //$this->form_validation->set_rules()
    if($this->form_validation->run() == FALSE)
    {
        //the form has not been submitted or there are errors
        $this->parser->parse("register", $data); 
    }
    else
    {
        //validated and submitted
        die();
    }
}

function login()
{
    $data['title'] = 'Login';
    $this->parser->parse("login", $data);
}
}

And the template is

Registration page
{form url='user/register'}

<table>
    <tr>
        <td>Username</td>
        <td><input type="text" name="reg_username" id="reg_username"></td>
    </tr>
    <tr>
        <td>Password</td>
        <td><input type="password" name="reg_password" id="reg_password"></td>
    </tr>
    <tr>
        <td>First Name</td>
        <td><input type="text" name="reg_firstname" id="reg_firstname"></td>
    </tr>
    <tr>
        <td>Last Name</td>
        <td><input type="text" name="reg_lastname" id="reg_lastname"></td>
    </tr>
    <tr>
        <td></td>
        <td><input type="submit" value="submitted"/></td>
    </tr>
</table>

{form}

I expect die() command to be executed when the form is submitted by it is not – please advice me what am I doing wrong?

P.S. The method I used to integrate Smarty into CodeIgniter is https://github.com/Vheissu/Ci-Smarty

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:52:33+00:00Added an answer on June 8, 2026 at 2:52 pm

    You must set at least one validation rule in your register() method. For example, something like:

    $this->form_validation->set_rules('reg_username', 'Username', 'required');
    

    From the Form_validation class documentation:

    Since you haven’t told the Form Validation class to validate anything yet, it returns FALSE (boolean false) by default. The run() function only returns TRUE if it has successfully applied your rules without any of them failing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using CodeIgniter's form validation . Here is an example: $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
I'm using CodeIgniter's form validation callback function, here is it: function _validate_rate($input, $field) {
I am using Code Igniter, The HMVC library , and Smarty with this library
I am using CodeIgniter to upload some files through a form. I know how
I'm using codeigniter framework and I'm getting this error when I've submitted my form:
I am using Codeigniter framework and I have a form with input fields. When
I am using codeigniter and Jquery. I have an upload form in my view
I'm using codeigniter, but what I've done is made a small upload form. When
I am using codeigniter framework for one of my PHP project. In form I
I'm building a CodeIgniter application and using Smarty as my templating system. Instead of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.