Analysis of skills in page value transfer for getting started with PHP

零下一度
Release: 2023-03-10 19:26:02
Original
1545 people have browsed it

Content of this section:
php pageSimple example of passing value

1, index.html

Copy Code Code example:

<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>
Copy after login

2, post.php

Copy code Code example:

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

For more tutorials related to php newbies, please refer to the more content introduced in the php introductory tutorial.

The above is the detailed content of Analysis of skills in page value transfer for getting started with PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!