form提交url伪静态,php提交表单后页面重定向代码

<?php
  if( $_POST["location"] )
  {
     $location = $_POST["location"];
     header( "Location:$location" );
     exit();
  }
?>
<html>
<body>
   <p>Choose a site to visit :</p>
   <form action="<?php $_PHP_SELF ?>" method="POST">
   <select name="location">
      <option value="http://w3c.org">
            World Wise Web Consortium
      </option>
      <option value="http://www.google.com">
            Google Search Page
      </option>
   </select>
   <input type="submit" />
   </form>
</body>
</html>

全文:http://outofmemory.cn/code-snippet/7555/php-tijiao-form-hou-page-zhong-direction-code
posted @ 2015-11-24 13:17  stma  阅读(674)  评论(0)    收藏  举报