1

I use this in my controller,

function phpcalview()
{
    $year = $this->input->post('yearvv');
    $year1 = $year+1;
    //echo $year1;
    $this->load->view('phpcal',$year1); 
}

How to $year1 value to my view phpcal and get that value in the textbox yearvv

2 Answers 2

3
function phpcalview()
{
    $year = $this->input->post('yearvv');
    $data['year1'] = $year+1;
    $this->load->view('phpcal',$data); 
}

in view:

echo $year1;
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks.. Is this the same way in all MVC based frameworks?
1

If you want to "get that value in the textbox yearvv" put this in your view:

<input type="text" name="yearvv" value="<?=$year1?>" />

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.