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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:15:10+00:00 2026-06-05T18:15:10+00:00

I am unsure what would be the best way to implement a success message

  • 0

I am unsure what would be the best way to implement a success message into a different div.

I also am getting the error div loaded into my view when the page is loaded why? I want it to show if only if there as an error.

If there is no error how could I change the div and include a success message?

View:

<div class="alert alert-error">
    <?php echo validation_errors();?>
</div>

Controller:

if($this->form_validation->run() === TRUE)
            {
                $userData = array(
                    'fName' => $this->input->post('userFirstName', TRUE),
                    'lName' => $this->input->post('userLastName', TRUE),
                    'email' => $this->input->post('userEmail', TRUE),
                    'password' => sha1($this->input->post('userPassword', TRUE))
                );  

                $this->db->escape($userData);
                $this->user_model->addUser($userData);
            }

            $data['contentMangement'] = $this->options_model->systemOptions();
            $data['pageTitle'] = 'Add User';
            $this->load->view('_assets/header', $data);
            $this->load->view('addUser', $data);
            $this->load->view('_assets/footer');
    }

Update:

<?php 

    $errorMessage = validation_errors('<div class="alert alert-error">', '</div>'); 
    $successMessage = '<div class="alert alert-success"><strong>Thank You</strong> Your User Has Been Added';   
        if($errorMessage)
        {
            echo $errorMessage;
        }else{
            echo $successMessage;
        }

    ?>
  • 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-05T18:15:13+00:00Added an answer on June 5, 2026 at 6:15 pm

    I have fixed this issue by the following:

        if($this->form_validation->run() === TRUE)
            {
                $userData = array(
                    'fName' => $this->input->post('userFirstName', TRUE),
                    'lName' => $this->input->post('userLastName', TRUE),
                    'email' => $this->input->post('userEmail', TRUE),
                    'password' => sha1($this->input->post('userPassword', TRUE))
                );  
    
                $this->db->escape($userData);
                $this->user_model->addUser($userData);
    
                $data['contentMangement'] = $this->options_model->systemOptions();
                $data['pageTitle'] = 'Add User';
                $data['message'] = '<div class="alert alert-success"><strong>Thank You</strong> Your User Has Been Added';
                $this->load->view('_assets/header', $data);
                $this->load->view('addUser', $data);
                $this->load->view('_assets/footer');
    
            }elseif($this->form_validation->run() === FALSE)
            {
                $data['contentMangement'] = $this->options_model->systemOptions();
                $data['pageTitle'] = 'Add User';
                $data['message'] = validation_errors('<div class="alert alert-error">', '</div>'); 
                $this->load->view('_assets/header', $data);
                $this->load->view('addUser', $data);
                $this->load->view('_assets/footer');
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have avoided working with fetchxml as I have been unsure the best way
What would be the best way to resize images, which could be of any
Unsure of the best way to describe this, but I need to calculate the
I have the following code but I am unsure how I would adjust it
NSResponder has a method you override called - indent:, but unsure when it would
I'm unsure on the best stack to build a chat application. Currently I'm thinking
I'm unsure how to do this. One way is: import urllib.request; urllib.request.urlretrieve('www.example.com/file.tar', 'file.tar') Another
I'm unsure if this is classed as a child and parent div. <div class=container>
What is the best way to code a search for my website developed in
I am unsure what the best combination of CSS rules and HTML elemtents is

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.