Welcome Guest, Not a member yet? Register   Sign In
FORM ACTION PROBLEM
#1

[eluser]nasir031[/eluser]
Hi all, I'm nob to codeigniter. My problem is that by clicking the submit button form isn't redirecting the control to provided controller that is, login.

Code:
<form action="login" method="post">
            <label for="log">
                <b>Username: </b>
            </label>
            &lt;input class="field" type="text" name="log" id="log" value="" size="23" /&gt;
            <label for="pwd">
                <b>Password:</b></label>
            &lt;input class="field" type="password" name="pwd" id="pwd" size="23" /&gt;
            &lt;input type="submit" name="submit" value="" class="button_login" /&gt;
&lt;!--            <a href="Login">Login</a>--&gt;
            &lt;input type="hidden" name="redirect_to" value="" /&gt;
            &lt;/form&gt;

HERE IS MY CONTROLLER CLASS

Code:
&lt;?php

class Login extends CI_Controller {
    //put your code here
    function __construct() {
        parent::__construct();
    }

    function index(){
        $this->load->view('welcomeForm.php');
    }

    function processForm(){
        $this->load->view('welcomeForm.php');
    }
}
?&gt;


Please Help Me, I've to submit application after 5 days..
#2

[eluser]Aken[/eluser]
Code:
&lt;form action="&lt;?php echo site_url('login'); ?&gt;" method="post"&gt;
#3

[eluser]nasir031[/eluser]
Thank You for replying Aken but doing in this way, all of my page becomes hidden except background nothing remain present there
#4

[eluser]nasir031[/eluser]
[quote author="Aken" date="1311164832"]
Code:
&lt;form action="&lt;?php echo site_url('login'); ?&gt;" method="post"&gt;
[/quote]

Thank You for replying Aken but doing in this way, all of my page becomes hidden except background nothing remain present there
#5

[eluser]nasir031[/eluser]
[quote author="nasir031" date="1311166481"][quote author="Aken" date="1311164832"]
Code:
&lt;form action="&lt;?php echo site_url('login'); ?&gt;" method="post"&gt;
[/quote]

Thank You for replying Aken but doing in this way, all of my page becomes hidden except background nothing remain present there[/quote]


And one other problem that I'm facing is, echo site_url()/ base_url is not accessible in my index.php even though I've auto loaded $autoload['helper'] = array('url');. what is the problem here... I'm unable to get it
#6

[eluser]Aken[/eluser]
You're getting PHP errors somewhere, that's probably what's messing up the HTML markup.

And I don't know what you mean by index.php page - you shouldn't need to add code to the index.php function, and I don't believe you can name a controller file index.php without some sort of conflict / error.
#7

[eluser]nasir031[/eluser]
[quote author="Aken" date="1311211731"]You're getting PHP errors somewhere, that's probably what's messing up the HTML markup.

And I don't know what you mean by index.php page - you shouldn't need to add code to the index.php function, and I don't believe you can name a controller file index.php without some sort of conflict / error.[/quote]

Yes you pointed right I'm getting PHP errors, that's my url helper isn't being auto loaded in autoload.php so, conciquently
Code:
&lt;form action &lt;?php echo site_utl()?&gt;....&lt;/form>
the form's action is not working because url helper hasn't yet loaded.
How should I solve this.?
By index.php my mean the front page that is loaded first in CI.

BUNDLE OF THANKS FOR YOUR REPLY
#8

[eluser]marcogmonteiro[/eluser]
why don't you just use the form helper? and do something like this:

echo form_open('mycontroler/login');

And you don't need nothing more... =)
#9

[eluser]broncha[/eluser]
@nasir
Why are you even trying to mess with the index.php.

The helpers will not have been loaded when index.php is being executed. so base_url() is not gonna work.

What are you exactly trying to do?




Theme © iAndrew 2016 - Forum software by © MyBB