check button click in php
程序代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www. button click in php</title> </head> <body> <h1>Check button click in php</h1> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <p> <input type="submit" name="b" value='b1' style="border:none; width:100px; cursor:pointer; color:blue;"> <input type="submit" name="b" value='b2' style="border:none; width:100px; cursor:pointer; color:blue;"> <?php if($_POST["b"] == 'b1') echo "<br/>" . "b1 clicked"; else if($_POST["b"] == 'b2') echo "<br/>" . "b2 clicked"; ?> </p> </form> </body> </html>
这段代码的意思在于通过php 来实现javascript 中的onclick 事件