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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:03:38+00:00 2026-06-15T00:03:38+00:00

i am newbie in codeigniter and jquery but the website i am maintaining now

  • 0

i am newbie in codeigniter and jquery but the website i am maintaining now uses this framework and language,.,.the problem is that i have these text fields and hidden fields in a page,,.i want to get the values of these input fields through jquery,.,passed these through $.post of jquery to a Controller,.,.i know how to track the flow but i do not know how to get the passed value in my controller and i am totally newbie in codeigniter and jquery,,i want to learn and at the same time finished the task,.,.
heres my code in my view page..

 <?php $date = date('m/d/Y');
    $ts = strtotime($date);
    $year = date('o', $ts);
    $week = date('W', $ts);
    for($i = 1; $i <= 7; $i++) {
           $ts = strtotime($year.'W'.$week.$i);
        ?><input type="text" name="days" class="days" /><input type="hidden" id="date_now" name="date_now" value="<?php print date("Y-m-d", $ts); ?>" />

    } 
?>

and my jquery for text input

$(".saveTimeSheet").click(function() { 
    var days_array     = [];
    var date_now_array = [];

    $('.days').each(function() {
            days_array.push($(this).val());
    });
    $.post("<?php print base_url().'index.php/MyController/saveTimeTable'?>", {days_array: days_array},
        function(data){
            if(data=='success')
            {
                alert('success');
            }
            else{
                error_message(data);
            }
    });
 });

MyController Code…

function saveTimeTable()
{
   $idnum=$this->session->userdata('id');       
       $duration=$this->input->post('days_array')*3600;
       $this->mmyhr->modeSaveTimeTable($idnum, $duration);
}

my Model code(mmyhr)

function modeSaveTimeTable($idnum, $duration)
{
   $this->db->set('employee_id', $idnum);
   $this->db->set('duration', $duration);
   $this->db->insert('hs_hr_time_event');
 }

could anyone help me,.,.please….

  • 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-15T00:03:40+00:00Added an answer on June 15, 2026 at 12:03 am

    Based on your code above your controller should be like this:

    function saveTimeTable()
    {
        $idnum=$this->session->userdata('id');
        $days_array = $this->input->post('days_array');
    
        foreach($days_array as $day){
            $duration=$day*3600;
            $this->mmyhr->modeSaveTimeTable($idnum, $duration);
        }    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im newbie here.I have a problem with codeigniter segment() method.I referred 6th segment of
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
I am newbie. I have Windows XP and use the CodeIgniter framework. I wanted
am newbie to jquery..I have a three steps registration form in which the user
I've read these pages regarding this: http://philsturgeon.co.uk/blog/2009/07/Create-an-Admin-panel-with-CodeIgniter Separate Admin and Front in codeigniter (look
Newbie to this forum... I was working on something lately and encountered a problem.
I am a newbie to drupal, and have used cakephp and codeigniter frameworks earlier.
I am a newbie in codeigniter. I want to load jquery on every page.
Experience level: newbie. The backbone.js Todos demo uses localStorage. This question is about how
Excuse me if this is slightly newbie. I have the main view located @

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.