Welcome Guest, Not a member yet? Register   Sign In
Value of variable from other function
#1

[eluser]Josssi[/eluser]
Hello people,
I am just starting with codeIgniter and need help for this moment. I have two function which are executing after press the button in view. Part of first one is below:

function make_price()

{
.......

$name = $this->customer_model->getCustomersName($_POST['customers']);

$this->template->set('title', 'Confirm');
$this->template->view('cash_submit_view', $name);
}


function confirm_pay()
{
$customer = and here i need get value of $name in the next function too...
}

can you help me somebody with this problem please?


#2

[eluser]TWP Marketing[/eluser]
[quote author="Josssi" date="1332033308"]Hello people,
I am just starting with codeIgniter and need help for this moment. I have two function which are executing after press the button in view. Part of first one is below:
Code:
function make_price()

{
                .......

  $name = $this->customer_model->getCustomersName($_POST['customers']);

  $this->template->set('title', 'Confirm');
  $this->template->view('cash_submit_view', $name);
}
  

function confirm_pay()
{
     $customer = and here i need get value of $name in the next function too...
}
can you help me somebody with this problem please?


[/quote]

I assume your view 'cash_submit_view" contains a form. Place the $name var as a hidden field so it will be returned in the $_POST array when the user submits the form content.
You might find the CI input class will work better thAn using the $_POST array. Check the user guide:
http://ellislab.com/codeigniter/user-gui...input.html




Theme © iAndrew 2016 - Forum software by © MyBB