在opencart中提交表单
Form submit in opencart
我是 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));
}
}
?>
但问题是当我点击提交时,页面导航到
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">
我是 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));
}
}
?>
但问题是当我点击提交时,页面导航到
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">