如何在Codeigniter中点击按钮链接页面


How to link page with button click in Codeigniter?

我正在尝试点击加载页面,我创建了一个电子邮件验证链接,打开页面并更新我的数据库,一切都很好,但页面包含一个按钮,我想被用户点击并打开第一个有登录窗口的页面。我的验证.html:

    <div class="container container-table">
    <div class="row vertical-center-row">
        <div class="text-center col-md-4 col-md-offset-4" style="background:blue">
            <h3> Thankyou For Veryfing</h3>    
            <p>You Are Verified</p>
            <form action="login.php/verify_to_login" method="post">
                <button type="submit" class="btn btn-success" >Sign Up>Go To Login</button> 
            </form>        
        </div>
    </div>
</div>  

我的控制器函数加载验证页面,如下所示:http://localhost/index.php/login/verify/1567af19e10ce4

        public function verify($VerificationCode){
         $this->load->model('My_model');
         $this->load->helper('url');
         $this->My_model->verifymail($VerificationCode);
         /* Send to the verification page */
         $this->load->view("verify.html");
    }

这是我想要的verify_to_log()函数,当我点击按钮时,它应该会打开header.htmlhttp://localhost/index.php/login/verify_to_login但事实恰恰相反http://localhost/index.php/login/verify/login.php/verify_to_login当我点击按钮时公共函数verify_to_log(){$this->load->view("header.html");}

我不明白为什么会发生这种事(

在html 上

<form method="" action="<?php  echo base_url(); ?>​controller_name/function_name">
       <button id="submit-buttons" type="submit" ​​​​​>Submit 1</button>
</form>

在控制器上

function functionname(){
    $this->load->view('some_view')
}

所以基本上你的控制器是好的,所以只需通过输入控制器名称,然后输入函数名称来修复按钮,所有这些都应该有望工作。

尝试

这个

<button type="submit" class="btn btn-success" onclick="window.location.replace('YOUR_LINK_HERE');">Sign Up>Go To Login</button>

<button type="submit" class="btn btn-success" onclick="window.location.href('YOUR_LINK_HERE');">Sign Up>Go To Login</button>