提交路线失败 - Codeigniter

时间:2017-12-01 06:31:25

标签: codeigniter routes

我有这个控制器/ insert.php作为我的控制器 这是localhost url

http://localhost/codeigniter/index.php/insert/data_submit/

但是当我点击提交按钮时,它会重定向到此链接

http://localhost/codeigniter/index.html/insert/data_submit/

我对Codeigniter很陌生,我正在尝试如何将数据插入数据库,但路由对我来说很复杂,有人可以解释为什么我的代码中会出现此问题吗? ::提前谢谢::

View / insert.php中的

代码

            <?php echo form_open('insert/data_submit/'); ?>
                        <table width="500" cellpadding="5" cellspacing="5">
                            <tr>
                                <td width="85"></td>
                                <td width="200" colspan="2">
                                <?php 
                                if (isset($ins_msg)) 
                                {
                                    echo $ins_msg;
                                } ?></td>
                            </tr>
                            <tr>
                                <td> Fullname: </td>
                                <td> <input type="text" name="full_name" value="<?= set_value('full_name'); ?>"> </td>
                                <td> <?= form_error('full_name'); ?> </td>
                            </tr>
                            <tr>
                                <td> Email: </td>
                                <td> <input type="text" name="email" value="<?= set_value('email'); ?>"> </td>
                                <td> <?= form_error('email'); ?> </td>
                            </tr>
                            <tr>
                                <td width="223">&nbsp;</td>
                                <td> <input type="submit" name="submit" value="Login" alt="Login"> </td>
                            </tr>   
                        </table>
                    </form>

1 个答案:

答案 0 :(得分:0)

确保您的config.php文件设置正确(application / config / cong.php),如下所示。

$config['base_url'] = 'http://localhost/codeigniter/';
$config['index_page'] = 'index.php';

另请查看autoload.php

$autoload['helper'] = array('url', 'file','form');