Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter Newbie Question
#1

hi Guys, 

I am new to CodeIgniter and also have average PHP knowledge. Just started learning CodeIgniter last week and having a basic problem which i can't overcome. my development environment is (OS,PHPStorm,MAMP,APACHE). CI project root is http://localhost:63342/CodeIgniter/ and this address loads my 'default_controller' (login.php in Controllers folder). this controller redirect me to my view "$this->load->view('login_view');". in my view i have a form with this line: <?php echo form_open('form'); ?> which supposed to take me to my form.php in Controller upon the form being submitted but it does not! when i submit i am taken to a url : http://127.0.0.1/CodeIgniter/form with error message "connection attempt to 127.0.0.1 was rejected.". 

Also when i try to type a url (i.e. http://localhost:63342/CodeIgniter/index.php/form) or amy other URL in fact, i get errors too. i was under impression that navigating through pages in CI is as simple as typing the name of the file and the method in it in my Controller folder. what am i missing here? any attempt to navigation through URL i get "404 Not Found" error. i am sure i am missing something very simple here but i can't figure out what. i have read the documentations and search the web and no answer is found. i have changed the .htdaccess in root, tried the enable mode in Apache, done all the necessary changes in Config.php , routes.php etc. i would appreciated it if you can tell what am i doing wrong here. i wasn't expecting getting started with CI to be this hard  Confused


cheers

Beshad
Reply
#2

A few things to check:
Did you setup your MAMP correctly?
Is localhost in your hosts file?
Did you set the $config['base_url'] to the correct path in your application/config.php file?
Do your controllers have names with first-caps?
If your form is pointing to a controller named "form", then there must be a method "index" inside it. That's how CI works: if you call a controller without a method name, it assumes you mean the index method. It's better practice to point your form to a controller that has a more meaningful name. In this case Login.php. Create a method ( = function) called "process_form".
In your view, point to this method: echo form_open('login/process_form');

I hope this will help you further.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB