codeigniter

Edit form echoes previously saved data correctly but does not update the form fields

孤街浪徒 提交于 2019-12-30 11:28:51
问题 Echoing previously saved data (excluding those from dropdown values) already works fine for me. I could see correct data saved for a particular record, however, after editing the form, I don't see anything successful after it. The data which were supposedly edited remain the same. Everything I typed to actually edit the echoed values went nowhere. I currently have this in my controller: public function edit_job() { $this->validateRole('client'); $this->load->model('job_model'); $id = $this-

CodeIgniter-Checking session variable is already set or not when clicking each link or reloading page

牧云@^-^@ 提交于 2019-12-30 11:22:26
问题 I have a controller named admin,and all functions in the controller can be used if the session variable is set,so what are the best ways to check if the session is set ,when clicking each link in the page or reloading the pages... for example: if i open my admin home page in multiple tabs in a browser and sign off from first tab, bt after that in the second tab all links a working properly so i want to check if the session is set or not... Thanks! 回答1: If you want to check whether the session

How to get an array of all controllers in a Codeigniter project?

邮差的信 提交于 2019-12-30 11:00:31
问题 I'd like to obtain a list of all controllers in a Codeiginiter project so I can easily loop through each of them and add defined routes. I can't seem to find a method that will give me what I'm after ? Here is the code snippet from the routes.php file where I would like to access the array: - // I'd like $controllers to be dynamically populated by a method // $controllers = array('pages', 'users'); // Loop through each controller and add controller/action routes // foreach ($controllers as

PHP - CodeIgniter - Invalid argument supplied for foreach()

对着背影说爱祢 提交于 2019-12-30 10:33:57
问题 I try to write a site with CodeIgniter but I've a problem with PHP. I'm sure that it's so simple and can't be wrong. But I don't know bugs from , just a newbie of CodeIgniter :) <html> <head> <title><?=$page_title?></title> </head> <body> <?php foreach($result as $row):?> <h3><? echo $row->title; ?></h3> <p><? echo $row->text; ?></p> <?php endforeach;?> </body> </html> I've a bug from this file : A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach()

Sending HTML Email results in Email displaying HTML source (Codeigniter Email Class)

我们两清 提交于 2019-12-30 08:49:06
问题 I am having problems with email sent via the email class in Codeigniter displaying the source HTML code in the email message instead of the rendered HTML view. For testing, I am currently having CI on XAMPP on Windows, and using Gmail SMTP to send to the same gmail address. The function that sends the email is as follows: $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => 'myaccountname@gmail.com', 'smtp_pass' =>

Codeigniter:Update Image and Display

主宰稳场 提交于 2019-12-30 07:34:11
问题 I'm stuck on a problem with updating image. I've created image upload which works fine but I also want it to be updated. When I add a need image it updates correctly but I if don't want to change the image and leave it as it is, then my current image can't be retrieve. Please help me Controller public function insert() { $data['s_em']=$this->input->post('s_em'); $data['s_na']=$this->input->post('s_na'); $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png|jpeg|jpe

Codeigniter:Update Image and Display

天大地大妈咪最大 提交于 2019-12-30 07:34:03
问题 I'm stuck on a problem with updating image. I've created image upload which works fine but I also want it to be updated. When I add a need image it updates correctly but I if don't want to change the image and leave it as it is, then my current image can't be retrieve. Please help me Controller public function insert() { $data['s_em']=$this->input->post('s_em'); $data['s_na']=$this->input->post('s_na'); $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png|jpeg|jpe

Getting the hang of CodeIgniter - Templating / loading views

孤街浪徒 提交于 2019-12-30 07:32:55
问题 Attempting to learn CI and going through the docs to get a better understanding. Without getting a separate library, I could make a template by including a list of views like so: $this->load->view('header'); $this->load->view('navigation'); $this->load->view('sidenav_open'); $this->load->view('blocks/userinfo'); $this->load->view('blocks/stats'); $this->load->view('sidenav_close'); $this->load->view('content',$data); $this->load->view('footer'); This makes sense but would I actually have that

Code igniter get ajax value from view to controller

懵懂的女人 提交于 2019-12-30 07:31:50
问题 How do I get send in my controller? This is what, I have tried out: Ajax $.ajax({ type: "POST", url: "example/name", data: send, success: function(value) { } }); Controller class Example extends CI_Controller { function name() { $this - > post(send); } } 回答1: Seems that you don't send your data properly. Try this: $.ajax({ type: "POST", url: "example/name", data: {send: send}, success: function(value) { } }); In this case you will be available as $_POST['send'] . 回答2: Try this one , this is

Code igniter get ajax value from view to controller

送分小仙女□ 提交于 2019-12-30 07:31:31
问题 How do I get send in my controller? This is what, I have tried out: Ajax $.ajax({ type: "POST", url: "example/name", data: send, success: function(value) { } }); Controller class Example extends CI_Controller { function name() { $this - > post(send); } } 回答1: Seems that you don't send your data properly. Try this: $.ajax({ type: "POST", url: "example/name", data: {send: send}, success: function(value) { } }); In this case you will be available as $_POST['send'] . 回答2: Try this one , this is