Welcome Guest, Not a member yet? Register   Sign In
Submit simple form don't work.
#2

[eluser]Rok Biderman[/eluser]
Hello Marcone and welcome to the CI forums. There are 3 things about this that strike me as odd.

You say the submit is redirecting you to the same page

Code:
<?=form_open('c_loginsyslogin/index/', $attributes)?>

It's exactly what it should do, you have to make an action to a different controller/method if you want that. But that is ok in my view.

Secondly, the script exits here,
Code:
echo 'para';
        exit;

so you have to remove the exit command if you want further processing.

And last, you redirect to c_/index (which is a protected page I assume) only if the user doesn't exist. If you want a redirect when there is a valid user, you need to put it here and delete the one from else part.

Code:
if(array_key_exists($user_name, $user_credentials))
                {
                    // continue processing form, i'm just redirecting
                    redirect('c_/index/');
                }

If you make these 3 changes, it only redirects if the username is valid, if the input is present it just says 'para' (probably for your debugging) and sets the message.

I just wanted to add that if you do it like this, you will need to build 2 separate processings for something that can be done in one as efficiently. You already check if the username (array_key) is present. Now you will have to do it once more for the user and pass matching. I don't know the rest of your code, but it seems redundant.


Messages In This Thread
Submit simple form don't work. - by El Forum - 05-09-2011, 12:24 AM
Submit simple form don't work. - by El Forum - 05-09-2011, 05:12 AM
Submit simple form don't work. - by El Forum - 05-09-2011, 12:09 PM
Submit simple form don't work. - by El Forum - 05-11-2011, 11:33 AM
Submit simple form don't work. - by El Forum - 05-11-2011, 01:15 PM
Submit simple form don't work. - by El Forum - 05-11-2011, 02:07 PM
Submit simple form don't work. - by El Forum - 05-13-2011, 09:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB