以下是我按下任何按钮时的代码,这两个方法都称为home.php和login.php。如何处理它,谢谢
<?php form_open('home.php'); ?>
<input type="hidden" name="operation" id="operation" value="home" />
<button type="submit" >Home</button>
<?php form_close(); ?>
<?php form_open('login.php'); ?>
<input type="hidden" name="operation" id="operation" value="login" />
<button type="submit" >Login</button>
<?php form_close(); ?>
答案 0 :(得分:0)
请使用此
<?php form_open('home.php'); ?>
<input type="hidden" name="operation" id="operation" value="home" />
<input type="submit" name="btnOperation" value="Home" />
<?php form_close(); ?>
<?php form_open('login.php'); ?>
<input type="hidden" name="operation" id="operation" value="login" />
<input type="submit" name="btnLogin" value="Login" />
<?php form_close(); ?>
AND in your controller
do this
if(isset($_POST['btnLogin'])
// process login
if(isset($_POST['btnOperation'])
// process operations.
Thanks.