Par*_*ria 2 php codeigniter submit form-submit
我已经为登录模式设计了此表单:
<tr>
<td></td>
<td><?php echo form_submit('submit', ' Log In', 'class="btn btn-primary btn-lg btn-block"'); ?>
<?php echo form_submit('forget', ' Forget Password ', 'class="btn btn-warning btn-lg btn-block"'); ?>
</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
这两个按钮都在做相同的工作,如何隔离按下的按钮?
谢谢大家
小智 5
您可以使用以下HTML来获得此代码:
<tr>
<td></td>
<td>
<button type="submit" name="action" value="submit" class="btn btn-primary btn-lg btn-block"> Log In </button>
<button type="submit" name="action" value="forget" class="btn btn-warning btn-lg btn-block"> Forget Password </button>
</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
然后像这样使用POST数据:
$action = $this->input->post('action');
if($action == 'submit') {
// execute code to log in
}
if($action == 'forget') {
// execute code to forget the password
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5399 次 |
| 最近记录: |