codeigniter-routing

how to pass id in controller from form action using codeigniter

隐身守侯 提交于 2019-12-08 09:37:42
问题 hey guys i am new in codeigniter,i have a form like this <form class="addinvestmentform" action="<?php echo base_url();?>index.php/ctl_dbcont/input_investment/$id" name="application" method="post" > //some code </form> i have a controller methode function input_investment($id) { $this->load->helper('form'); $this->load->helper('html'); $this->load->model('mod_user'); $this->mod_user->insertinvestment($id); } i want to get $id from form action to controller methode how can i do that . . pls

Codeigniter ci_sessions table storing ip address as 0.0.0.0 why? even when hosted I am getting 0.0.0.0

前提是你 提交于 2019-12-08 05:04:40
问题 Hello in my codeigniter I have created table as ci_sessions with following fields CREATE TABLE IF NOT EXISTS `ci_sessions` ( session_id varchar(40) DEFAULT '0' NOT NULL, ip_address varchar(45) DEFAULT '0' NOT NULL, user_agent varchar(120) NOT NULL, last_activity int(10) unsigned DEFAULT 0 NOT NULL, user_data text NOT NULL, PRIMARY KEY (session_id), KEY `last_activity_idx` (`last_activity`) ); Every field is working fine, except ip address which is storing as 0.0.0.0 for every client. I have

CodeIgniter Paging 404

和自甴很熟 提交于 2019-12-06 22:34:32
I've checked several threads on here regarding paging in CodeIgniter but I haven't found a solution to my problem. I have a controller class located at controllers/admin/index.php called 'Index' that contains the following code: class Index extends CI_Controller { public function __construct() { parent::__construct(); $this->load->helper("url"); $this->load->helper( 'events_helper' ); $this->load->helper( 'delegates_helper' ); $this->load->model( 'admin/event_model' ); $this->load->model( 'admin/delegate_model' ); $this->load->library( 'pagination' ); } public function index() { $config =

How to organize country/state/city browsing in MVC

一笑奈何 提交于 2019-12-04 20:25:06
I'm creating an ajax-based website that includes a country/state/city browsing interface. For SEO purposes, I want to include the name of the country/state/city in the URL. For example, the url may include additional variables, and would be something like: http://www.website.com/browse#!USA/NY/Albany http://www.website.com/browse#!USA/NY/Albany?Category=sports I need to fit this functionality into an MVC framework (specifically CodeIgniter) through AJAX. I'm not sure how to organize the major components, specifically the Controller, AJAX Handlers, and possible Library class. Is there a

Codeigniter routing and REST server

我的未来我决定 提交于 2019-12-03 16:47:29
I'm trying to achieve the following URLs for my API (I'm using Codeigniter and Phil Sturgeon's REST server library ): /players -> refers to index method in the players controller /players/rookies -> refers to rookies method in the players controller I don't want the URL to have a trailing "index" /players/index This is no problem at all when I define the routes like so: $route['players'] = 'players/index'; Everything works as expected. My problem is that I need additional URL segments like so: /players/rookies/limit/10/offset/5/key/abcdef The above example works, but the following does not:

How to route 2 parameters to a controller?

三世轮回 提交于 2019-12-03 16:12:50
问题 This seems really basic but i can't get the hang of it. I'm trying to send more then one parameter to a method in the controller, like this : http://localhost/ci/index.php/subjects/3/state This is the routings i've tried : $route['subjects/(:num)'] = 'subjects/view/$1'; $route['subjects/(:num)/{:any}'] = 'subjects/view/$1/$2'; the method accepted 2 paremeters : public function view($slug, $id = null){ } but i seem to get a 404. How can i get this to work? i need the view method to always

Codeigniter URL: How to display id and article title in the URL

故事扮演 提交于 2019-12-03 08:51:33
问题 Please see the following link structure http://stackoverflow.com/questions/10672712/voting-system-like-stackoverflow In the above link the 10672712 is the question id I guess, because if you check the following link you will get to the same location as above: http://stackoverflow.com/questions/10672712 Now if you use the above link then you will notice that in the browser's address bar the link automatically adds the question title (as slug) after the question id and it appears just like the

How to route 2 parameters to a controller?

早过忘川 提交于 2019-12-03 05:38:05
This seems really basic but i can't get the hang of it. I'm trying to send more then one parameter to a method in the controller, like this : http://localhost/ci/index.php/subjects/3/state This is the routings i've tried : $route['subjects/(:num)'] = 'subjects/view/$1'; $route['subjects/(:num)/{:any}'] = 'subjects/view/$1/$2'; the method accepted 2 paremeters : public function view($slug, $id = null){ } but i seem to get a 404. How can i get this to work? i need the view method to always accept 1 parameter and optional other parameters. NOTE : I am including the url helper. you have problem

codeigniter and cpanel installation

若如初见. 提交于 2019-12-02 11:25:38
问题 I am completely new to moving codeigniter to my web-server and im having trouble with the configuration. Where do I place my codeigniter project folder in www under myurl.com in in the very root directory? Am i supposed to move out the application and system folders? I am trying to remove index.php? from my URL name where do i place my .htaccess file in the root or in the same folder as my codeigniter directory? I wish to be able to type in (www.myurl.com) and be redirected to my home

Routes in Codeigniter - 404 Page Not Found

孤街醉人 提交于 2019-12-01 06:26:18
Can someone tell me, where the issue is ?? This is my controller class Support extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('support_model'); $urlarray = array("index","delete"); if(!in_array($this->uri->segment(2),$urlarray)){ $this->viewticket($this->uri->segment(2)); } } public function viewticket($id){ if(!empty($id)){ $this->load->view('templates/logged_header'); $this->load->view('support/view'); $this->load->view('templates/footer'); } } } Here is my routes.php $route['default_controller'] = "welcome"; $route['benefits'] = 'welcome