Welcome Guest, Not a member yet? Register   Sign In
Forms and form action
#5

[eluser]zlatiborac[/eluser]
OK, I made simple example of how I did this so here it is:

first I made controller named pages.php and I saved it in application/controllers folder. Here is the source:
Code:
<?php



class Pages extends Controller
{
    
    function Pages ()
    {
        parent::Controller();
    }    
    
    function index ()
    {
        $this->load->view("test");
    }    
}
// end of file
As you can see it only loads view file named test.

After this I made a file called test.php and saved it in my application/views folder. Here is the source from that file:
Code:
<?php

    echo form_open('form');
    echo form_input('name','Your name');
    echo form_submit('submit', 'Send data');
    echo form_close();
    
?>
Quite simple form, with only one input field and submit button. form_open is calling, if I am right, the file named form.php which resides in controllers folder so I made that file and here is it's source:
Code:
<?php
class Form extends Controller
{
    function index ()
    {
        echo "SENT--------";
    }
}
(I've intentionally left out closing ?> because it states in the manual that closing ?> can be left out)
Now when I click on submit button all I get is this form again (if I change "Your name" in something else and after I click on button I get the same form with "Your name" in input field; so it is reloading the same form again).
This is the way I did this and how I understood you reply... Am I correct?


Messages In This Thread
Forms and form action - by El Forum - 05-04-2009, 01:33 PM
Forms and form action - by El Forum - 05-04-2009, 01:41 PM
Forms and form action - by El Forum - 05-04-2009, 02:06 PM
Forms and form action - by El Forum - 05-04-2009, 02:14 PM
Forms and form action - by El Forum - 05-05-2009, 12:03 PM
Forms and form action - by El Forum - 05-05-2009, 06:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB