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 (标签-STM32|关键词-智能小车)
  • ¥20 关于#stm32#的问题,请各位专家解答!
  • ¥15 (标签-python)
  • ¥15 第一个已完成,求第二个做法
  • ¥20 搭建awx,试了很多版本都有错
  • ¥15 java corba的客户端该如何指定使用本地某个固定IP去连接服务端?
  • ¥15 activiti工作流问题,求解答
  • ¥15 有人写过RPA后台管理系统么?
  • ¥15 Bioage计算生物学年龄
  • ¥20 如何将FPGA Alveo U50恢复原来出厂设置哇?