一般情况下:
1、$_POST用于表单之中,而$_GET用于超链接之中。
2、$_POST对数据来说比较安全,而$_GET就略显不足。
代码如下:
$_POST 用法:<form method="post" action="text17.php"> 姓 名:<input type="text" name="username"/><br/> 密 码:<input type="password" name="password"/> 验证码:<input type="text" name="code" size="5"/>1234<br/> 内 容:<textarea rows="6" cols="25" name="content"></textarea><br/> <input type="submit" value="提交" name="send"> </form><?phpif (!isset($_POST['username'])) { header('location:text17.php'); exit; } else { $username = $_POST['username']; $password = $_POST['password']; $code = $_POST['code']; $content = $_POST['content']; echo '用户名:'.$username.'<br/>'; echo '密 码:'. $password.'<br/>'; echo '验证码:'.$code.'<br/>'; echo '介 绍:'.$content.'<br/>'; } if (strlen($username) <= 2) {header('location:text17.php'); exit; }$_GET 用法:<a href="text19.php?a=5">huangjinao </a><?php echo $_GET['a'];