表单在opencart中提交

纳拉亚娜·普萨拉(Narayan Pusarla)

我是Opencart的新手。我必须为用户编写一个自定义的登录表单。然后,我在opencart中为登录表单设计了一个小的代码,如下所示。路径是(MyTheme / temlate / auth / Sign.tpl)

<form action="<?php echo $Sub; ?>" method="GET" enctype="multipart/form-data">
Name:<Input type="text" name="txtUser">
<br>
Password:<input type="password" name="txtPassword"><br>
<input type="submit">   

和控制器就像(路径是controller / auth / Sign.php)

    <?php
    class ControllerAuthSign extends Controller{
        public function index() {
            $data['Sub']=$this->url->link('auth/result','','SSL');

            if(file_exists(DIR_TEMPLATE . $this->config->get('config_template'). '/template/auth/sign.tpl')){
                $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/auth/sign.tpl',$data));
            }
            else{
                $this->response->setOutput($this->load->view('default/template/account/login.tpl'));
            }
        }
    }
?>

用户提交表单时必须导航到“结果”页面(路径为/auth/result.tpl)

    <?php
    echo "Welcome : Mr./Mrs. ".$User;   
?>
<br><p>Your are Loged-In</p>

和结果的控制器是..(路径是/auth/result.php)

    <?php
    class ControllerAuthResult extends Controller{
        public function index() {
            $data['User']=$_REQUEST['txtUser'];
            $data['Password']=$_REQUEST['txtPassword'];

            if(isset($data)){
                $this->response->redirect($this->url->link('auth/sign', '', 'SSL'))
            }
            $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/auth/result.tp',$data));
        }
    }
?>

但是问题是当我单击Submit时,页面导航到

http://localhost/opencart/index.php?txtUser = Narayana&txtPassword = narayana

并显示索引页面。谁能帮助您导航到结果页面...?

提前致谢。

阿里·齐亚

用这个

<form action="<?php echo $Sub; ?>" method="POST" enctype="multipart/form-data">
Name:<Input type="text" name="txtUser">
<br>
Password:<input type="password" name="txtPassword"><br>
<input type="submit">

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章