dry0106 2013-09-25 17:15
浏览 17
已采纳

似乎可以在codeigniter中提交表单并转到下一个视图?

below is my 'mainview.php' view. from here iam attempting to submit and just open the next view which is called 'carerview.php'.

<form action="<?php echo base_url()?>login" method="post">                    
    <div class="input-prepend">
         <span class="add-on"><i class="icon-envelope"></i></span>
          <input type="text" id="" name="" placeholder="your@email.com"></br></br>

          <div class="input-prepend">
              <span class="add-on"><i class="icon-lock"></i></span>
              <input type="password" id="" name="" placeholder="Password"></br></br>
              <button type="submit" class="btn btn-primary"><i class="icon-user icon-white"></i>Sign in</button>
          </div>
    </div>
</form>

Iam trying to submit this is giving me issues.The Index page loads which contains the above view. but when i submit . i get requested URL not found on this server . then if i use the full url action="application/controllers/user/login" i get a forbidden, dont have permission to access it.

my method in my controller class is just to load the next view on submit so i dont think there is an issue there . below is the controller

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

 class User extends CI_Controller {

    public function index()
    {

            if(!$this->isLoggedIn())
            {
            $this->load->view('mainview');
            }
            else
            {
            //do something
            }

    }


    public function login()
    {
    $this->load->view('carerview');

    }



    public function isLoggedIn()
    {
    return false;
    }

}

any help would be appreciated thanks.

  • 写回答

2条回答 默认 最新

  • dougang2749 2013-09-25 17:45
    关注

    if you didn't remove index.php from your URL and didn't set anything to base_url in configuration,try this

    <?php echo base_url();?>index.php/user/login
    
    localhost/your_app_folder/index.php/controller/action
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 深度学习残差模块模型
  • ¥50 怎么判断同步时序逻辑电路和异步时序逻辑电路
  • ¥15 差动电流二次谐波的含量Matlab计算
  • ¥15 Can/caned 总线错误问题,错误显示控制器要发1,结果总线检测到0
  • ¥15 C#如何调用串口数据
  • ¥15 MATLAB与单片机串口通信
  • ¥15 L76k模块的GPS的使用
  • ¥15 请帮我看一看数电项目如何设计
  • ¥23 (标签-bug|关键词-密码错误加密)