-1

I had a problem when trying to retrieve data from the array ( from view to controller ) , I've tried to use the session in view . but could not as well .

contrroller:

public function returnurl()
    {
        $dataview =  $this->load->view('user/return_url');
        // $this->load->view($this->template,$dataview);

        $status = $dataview['PAYMENT_STATUS'];

        if ($status == 'S'){
            redirect(site_url('registration/previewData'));
        } else {
            redirect(site_url());
        }
    }

view:

<?php
 var_dump($_POST);exit;

 foreach ($_POST as $name => $value) {
    echo $name . ' : ' . $value . '<br />';

}

$this->session->set_userdata($_POST);
  ?> 
</body>
</html>

Output array from view:

array(2) { ["PAYMENT_STATUS"]=> string(1) "S" ["MERCHANTID"]=> string(9) "testingid"}

I would like if payment_status = 'S' . he will redirect another page (as I have defined in the controller).

Has anyone already encountered this problem ? Please help , thanks before .

1 Answer 1

1

That's not how MVC works. Please read more about what each of them stands for. The data is passed from a controller to the view for presentation.

In order to pass some data to a controller, you should make another server request (like submitting a form or making an AJAX call) and then read the data.

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

Comments

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.