Blogger Information
Blog 24
fans 1
comment 0
visits 21884
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
运行原理与http请求类型--2019年4月15日
王先生的博客
Original
1082 people have browsed it

无标题.png



<?php

  if(isset($_POST['text'])){

    print_r($_POST['text']);

  }

  else {

    echo '';

  }

?>

<!DOCTYPE html>

<html>

<head>

  <meta charset="UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <meta http-equiv="X-UA-Compatible" content="ie=edge">

  <title>Document</title>

</head>

<body>

  <form action="" method="post">

    <p>

      <label for="">账号:</label>

      <input type="text" name="text" value="">

    </p>

    <p>

      <label for="">密码:</label>

      <input type="password" name="password " value="">

    </p>

    <button>确认</button>

  </form>

</body>

</html>


1.jpg  2.jpg

使用一个非空判断 isset() 如果不是空为true  否则为false   如果不为空 就输出$_POST['text']的值  如果为空 则输出一个空字符串  


总结:

1:通过本次学习,详细掌握了浏览器 服务器 php 之间的运行原理及步骤,知道了各个功能模块的作用,

2:value="<?=$_POST['text']?:''?>"  可以在value内部加入 粘性表单  使用户体验度更高 

Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post