php通过GET方式提交表单演示,$_PHP_SELF表示当前页面,php中通过$_GET变量获得用户提交的信息
- <?php
- if( $_GET["name"] || $_GET["age"] )
- {
- echo "Welcome ". $_GET['name']. "<br />";
- echo "You are ". $_GET['age']. " years old.";
- exit();
- }
- ?>
- <html>
- <body>
- <form action="<?php $_PHP_SELF ?>" method="GET">
- Name: <input type="text" name="name" />
- Age: <input type="text" name="age" />
- <input type="submit" />
- </form>
- </body>
- </html>
来源: http://www.phpxs.com/code/1003249/