validation_form error |
[eluser]dilawaiz[/eluser]
hello everyone ! i'm a beginner of codeIgnitor and trying to make basic login page but im having error that verifylogin page doesnt exist although i have created it . plz anyone guide me where i'm mistaken . thank you <?php echo validation_errors(); ?> <?php echo form_open ('verifylogin'); ?> <label for="username"> username:</label> <input type="text" size="20" id="username" name="username"/> <br/> <label for= "password"> password:</label> <input type="password" size="20" id="password" name="password"/> <br/> <input type="submit" value="Login"/> </form>
[eluser]TWP Marketing[/eluser]
[quote author="dilawaiz" date="1348337306"]hello everyone ! i'm a beginner of codeIgnitor and trying to make basic login page but im having error that verifylogin page doesnt exist although i have created it . plz anyone guide me where i'm mistaken . thank you <?php echo validation_errors(); ?> <?php echo form_open ('verifylogin'); ?> <label for="username"> username:</label> <input type="text" size="20" id="username" name="username"/> <br/> <label for= "password"> password:</label> <input type="password" size="20" id="password" name="password"/> <br/> <input type="submit" value="Login"/> </form> [/quote] First, enclose your code in the [ code]...[/ code] tags to make it easier to read From the USER GUIDE: http://ellislab.com/codeigniter/user-gui...elper.html The action method usually includes the controller and method to be called when the user submits the form. Your code: Code: form_open ('verifylogin');
[eluser]dilawaiz[/eluser]
thanks and do u mean that i should write form_open('home/verifylogin') rather than form_open('verifylogin') ?
[eluser]TWP Marketing[/eluser]
[quote author="dilawaiz" date="1348384009"]thanks and do u mean that i should write form_open('home/verifylogin') rather than form_open('verifylogin') ? [/quote] Yes, form_open('home/verifylogin') is the intended format to pass the action parameter using the form helper. Assuming that 'home' is your controller class name and 'verifylogin' is the method you want to run when the user clicks on the submit button. It also assumes that you have set the correct value for 'base_url' in /application/config/config.php
[eluser]dilawaiz[/eluser]
thanks for your reply ... but VerifyLogin is my controller class and index() is its function which i want to be run on user's click. so do i have to write form_open('VerifyLogin/index') ? i tried this but it didn't work . moreover, i haven't set any base_url . what it should be like ? and also i want to ask that in form_open('...') we are supposed to write the page or the controller/funtion ? or both scenarios can be adopted ? if you make me able to make this login page .. i would be really thank full to you .
[eluser]dilawaiz[/eluser]
and also plz check my helper class . Code: function index(){ and in autoload i have set like this Code: $autoload['helper'] = array('url');
[eluser]TWP Marketing[/eluser]
[quote author="dilawaiz" date="1348485752"]and also plz check my helper class . Code: function index(){ and in autoload i have set like this Code: $autoload['helper'] = array('url'); In reverse order: 2) You don't need to load the 'url' helper twice. If you load it in config/autoload.php, then you do not need to load it again in the controller. If your form uses the action 'verifylogin', then you have a loop and no code to process the form data. It will just reload the same view: 'login_view'. 1) OK, Since your controller class name is Verifylogin and you intend to run the index function Your action variable for form_open('verifylogin') is correct, but check the capitalization. The name in the class declaration IS capitalized, and the usage in form_open() may or may not be (sorry, it varies with the operating system). Try using uncapitalized and Capitalized. Since I haven't seen your entire controller code, be sure you have the correct constructor code for your version of CI. Also check the permissions on the controller file itself.
[eluser]dilawaiz[/eluser]
thanks for replying but i'm sorry i'm still not able to resolve . here's my code Code: <?php if(! defined ('BASEPATH')) exit ('No direct script access allowed'); Code: <html> Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]TWP Marketing[/eluser]
[quote author="dilawaiz" date="1348483944"] ... moreover, i haven't set any base_url . what it should be like ? ... [/quote] In your file: application/config/config.php Set the base_url value as in the example Code: /* If you leave it blank, then CI will try to "guess" at the base_url. It is not always successful.
[eluser]dilawaiz[/eluser]
thanks alot... im through it i was not properly calling the function form_open (...) and yeah also base_url thing.. now its working . thanks for your help !! |
Welcome Guest, Not a member yet? Register Sign In |