0

I am porting an application to codeigniter developed in core PHP. By default query string functionality is disabled and I don't want to turn it on because I want the URLs to look clean. I have a page where there three forms: login form, registration form and forget password form. By default all the forms are collapsed. When the user opens this page from some other page by clicking on 'Login' button then login form should expand, and if the action of the user was "Register" button then registration from should exapnd when page is loaded. The earlier developer has appended action attribute to button links and added "login" and "register" values to them. This helps him to retrieve whether request was for login or register and he expands the collapsed form accordingly. But since codeignter URLs don't work this way how do I remember the user action when login or register button is clicked?

I am sorry if I could not write it clearly what I am trying to ask, if further information is needed I can edit and write more.

Thanks!

1 Answer 1

1

When in controller save the action in a variable:

$data = array();
$data['action'] = $this->input->post('submit');  #retrieve the action depending on the submit name
$this->load->view('view', $data);

Now, you will get the $action in the view and show the form depending upon it. Hope it helps you.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you. It has helped me.
Happie to help mate. :D. Consider accepting the answer. @user2885137

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.