开发者

Post not working from text input, with CI

开发者 https://www.devze.com 2023-01-11 12:08 出处:网络
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

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" 开发者_如何学JAVAid="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>


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

0

精彩评论

暂无评论...
验证码 换一张
取 消