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 899025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:08:51+00:00 2026-05-15T15:08:51+00:00

I try to set up a password in a codeigniter form… Everything seems ok

  • 0

I try to set up a password in a codeigniter form…
Everything seems ok to my eyes but no matter which password I use the form is still submitted…

here is the code in the controler:

class MyBlog extends Controller{


   function MyBlog(){
       parent::Controller();
       $this->load->helper(array('url','form','html')); //here we load some classes that we use 

       $this->load->scaffolding('entries');  //scaffolfing is a feature that lets you add or remove elements from the database
        $this->load->scaffolding('comments');

       $this->load->library('form_validation');//load validation class used to validate our forms...
   }

  function index(){

      $data['title'] = "My Blog Title"; //the title of my blog
      $data['query'] = $this->db->get('entries'); //here we make a small query to entries table


      $this->load->view('myBlog_view', $data); ///load all data variables on myBlog_view.php
     //this is also for the form validation


        $this->form_validation->set_rules('title', 'Title', 'required');
        $this->form_validation->set_rules('body', 'Body', 'required');
        $this->form_validation->set_rules('author', 'Author', 'required');
        $this->form_validation->set_rules('pass', 'Pass', 'callback_pass_check');


        function pass_check($str) {
        if ($str == 'baywatch'){
            return TRUE;
        }
        else{
            return FALSE;
        }
    }



      if ($this->form_validation->run() == TRUE)
        {   


            $this->myBlog_insert();
            //$this->load->view('formSuccess_view');
        }

      }



 function myBlog_insert(){

        $insert = array( 'title' => $_POST['title'],
                        'body' => $_POST['body'],
                        'author' => $_POST['author']
                        );

       $this->db->insert('entries',$insert);

       redirect('myBlog/');
       }


} 

and this is my form:

<div class="theForm">

<?php echo $this->form_validation->error_string; ?>
<?php echo validation_errors(); ?>
<?php echo form_open('myBlog'); ?>


<label for="title">Title:</label>

<input type='text' name="title" size="40" id="title" />
<p>
<label for="body">Body:</label>
<textarea name="body" rows = "10" cols="60" id="body"></textarea>
</p>
<p>
<label for="author">Author:</label>
<input type="text" name="author" size="40" id="author"/>
</p>
<p>
<label for="pass">Password:</label>
<input type="password" name="pass" size="38" id="pass"/>
</p>
<p><input type="submit" value="Submit New Post"/></p>
</form>
</div>
</body>
</html>

any ideas?
thanks in advance

  • 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-05-15T15:08:52+00:00Added an answer on May 15, 2026 at 3:08 pm

    Ok guys…I found what the problem was…function pass_check was declared inside index()…and for some reason it needs to be outside as a method of the class…Hope this will help others… I give some ups for all the suggestions…

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

Sidebar

Ask A Question

Stats

  • Questions 451k
  • Answers 451k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Plan for software boundaries (Windows SharePoint Services) May 15, 2026 at 8:55 pm
  • Editorial Team
    Editorial Team added an answer You're only writing a response header for css requests, for… May 15, 2026 at 8:55 pm
  • Editorial Team
    Editorial Team added an answer Ok, I figured this out (finally). When you launch the… May 15, 2026 at 8:55 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.