gongzhonghao.png
扫码关注我们
最新赞助活动温馨提示:自愿赞助服务器费用,学生和没有工作的整站资源免费下载!
头像

php入门之页面传值的技巧解析

来源:http://erdangjiade.com/topic/3131.html 你好,世界。 2017-09-25 22:42浏览(13)

本节内容:
php页面传值的简单例子

1,index.html

复制代码 代码示例:

<html>
 <
head
> 
  <title> 留言本首页 - www.jbxue.com</title>
 <body>
  <h1>Hello,Welcome to imchaotan 留言本</h1><br />
  <h3>留下您宝贵的建议吧?</h3>
  <table align="center" vspace=80 >
   <form method="post" 
action
="post.php">
    <tr>
      <td>账户:</td>
      <td><input type="text" name="id"  /></td>
    </tr>
    <tr>
     <td>想说点什么?</td>
     <td><input type="text" name="guess" size="60" /></td>
    </tr>
    <tr>
      <td><input type="submit"  value="提交" /></td>
      <td><input type="
reset
"  value="重置" /></td>
    </tr>
   </form>
  </table>
  
   </body>
 </head>
</html>

2,post.php

复制代码 代码示例:

<? 
   if(empty($_POST['id']))
   {
    
echo
 "账户不能为空,5秒后自动返回登录界面";
    header("refresh:5;URL='index.htm'");
   }
   
else
if(empty($_POST['guess']))
   {
    echo "文本不能为空,5秒后自动返回登录页面";
    header("refresh:5;URL='index.htm'");
   }
     else {
      $id=$_POST['id'];
      $guess=$_POST['guess'];
     echo"Hello".$id."你的留言是".$guess."<br />";
     }
 ?>

更多php新手相关的教程,请参考php入门教程中介绍的更多内容。

以上就是php入门之页面传值的技巧解析的详细内容,更多请关注二当家的素材网其它相关文章!

评论0
头像

友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群

1 2