0

I'm trying to post some information from a from do so some calculations, however for some reason that data isn't posting. I do a var_dump after I get the info, and it still is blank. Any help would be great.

My Controller:

<?php
class Timevalueshow extends Controller{

function index(){       
    $this->load->view('Timevalueshow_view');
}

function submit(){

    $years = $this->input->post('years');
    $rate = $this->input->post('rate');
    $principle = $this->input->post('principle');
    $periods = $this->input->post('periods');
    $isCont = $this->input->post('continuous');

    var_dump($years);

    $params = array(
        'years' => $years, 
        'rate' => $rate, 
        'principle' => $principle, 
        'periods' => $periods, 
        'isCont' => $isCont
    );

    var_dump($params);
    $this->load->library('timevalue',$params);
    $this->timevalue->leprint();
}
}
?>

And the view file.

<head>
    <title>Time Value of Money</title>
</head>

<body>
    <div id="container">

        <form method="POST" action="http://localhost:8888/CodeIgniter_1.7.2/index.php/timevalueshow/submit">
            <p>Years: </p> <input id="years" type="text" />
            <p>Rate: </p> <input type="text" id="rate"/>
            <p>Principle: </p> <input type="text" id="principle"/>
            <p>Periods: </p> <input type="text" id="periods"/>
            <p>Continuous?: </p> <input type="checkbox" id="continuous"/>
            <input type="submit" value="Submit"/>
        </form>

    </div>
</body>

1
  • If you do a print_r($_POST); at the beginning of the function (before you declare all of the variables) do you get anything?
    – tplaner
    Aug 10, 2010 at 14:09

1 Answer 1

2

You didn't submitted the form elements' name's only their id's. Edit your form so the elements contain name attributes too.

1
  • Wow, I thought I tried that and it didn't work, but it did this time. Thanks so much.
    – tshauck
    Aug 10, 2010 at 14:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.