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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:43:06+00:00 2026-06-11T13:43:06+00:00

Ok, so i have a test page right now that is just testing my

  • 0

Ok, so i have a test page right now that is just testing my point system. Pretty much when the user his the button, it gives them 5 points. The problem right now is everytime i refresh the page the user gets 5 points. What is up with this? If necessary I can post the libraries and models functions. Here is the controller and view:

welcome.php view:

Hi, <strong><?php echo $username; ?></strong>! <?php echo $fullname ?> is now logged in now. </br>
You have <?php echo $points; ?> Points.</br>
<?php echo anchor('/auth/logout/', 'Logout'); ?></br>
<?php echo form_open('add_points'); ?>
<?php echo form_submit('/auth/add_points/', 'Get 5 free Points!'); ?>
<?php echo form_close(); ?>
<?php echo var_dump($pointhistory); ?>

welcome.php controller:

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

class Welcome extends CI_Controller
{
        function __construct()
        {
                parent::__construct();

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

        function index()
        {
                if (!$this->tank_auth->is_logged_in()) {
                        redirect('/auth/login/');
                } else {
                        $data['user_id']        = $this->tank_auth->get_user_id();
                        $data['username']       = $this->tank_auth->get_username();
                        $data['fullname']       = $this->tank_auth->get_fullname();
                        $data['points']         = $this->tank_auth->get_points();
                        $data['pointhistory']   = $this->tank_auth->get_point_history();
                        $this->load->view('welcome', $data);
                }
        }
}
  • 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-11T13:43:07+00:00Added an answer on June 11, 2026 at 1:43 pm

    To fix what you have, just check in you controller if the page has a post submitted to it and not just a refresh:

    You could use this:

    if($_POST)
    {
       // do something
    }  
    

    OR

    A better way would be to use an AJAX call and not refresh the page at all. This would probably be the best solution.

    To do an AJAX post in Codeigniter, you just need to call a public function in your controller and echo the value to return, I would use JSON.

    jQuery makes this really easy on the client side: http://api.jquery.com/jQuery.ajax/

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

Sidebar

Related Questions

The way I have my page set up right now is pretty solid. I
I have a Test Class, that test the access of all page with different
http://blog.helpcurenow.org/test/mockups/mar2010/lp.html In the above landing page, I have an offers box that has four
I have a simple page for a chat system. Test page can be found
Note: I'm using Google Chrome Currently I have this test page http://www.evecakes.com/doodles/canvas_size_issue.htm It should
I have a very simple test page for PHP session. <?php session_start(); if (isset($_SESSIONS['views']))
I am setting up a simple test page in Python. I only have two
I have to write integration test case for my one feature listing page and
I have a simple page. One Rich Text Box bound to a test table
I have a page like below; <style type=text/css> #test a{ display: block; width: 150px;

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.