Blogger Information
Blog 27
fans 2
comment 0
visits 19685
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP流程控制,循环---PHP九期线上班
一丁
Original
630 people have browsed it

1.GET

GET传递数据,PHP处理,输出结果

HTML代码:

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>GET传递数据</title>
</head>
<body>
<form action="get.php" method="get">
    <p><label for="title">标题</label>
        <input type="text" name="title" id="title">
    </p>
    <p><label for="content">内容</label>
        <textarea name="content" rows="10" cols="30" id="content"></textarea>

    </p>
    <p>
        <button>提交</button>
    </p>
</form>
</body>
</html>

点击 "运行实例" 按钮查看在线实例

PHP代码:

实例

<?php
$t=$_GET['title'];
$c=$_GET['content'];
echo '提交成功','<br>';
echo '标题:',$t,'<br>';
echo '内容',$c;

运行实例 »

点击 "运行实例" 按钮查看在线实例


或者浏览器直接输入(php文件名后?加表单里的name):

http://localhost/get.php?title=GET&content=PHP


运行结果图:

image.png

image.png

2.POST(扩展题)

POST发送数据,PHP处理,输出结果

HTML代码:

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>POST发送数据</title>
</head>
<body>
<form action="form.php" method="post">
    <p><label for="title">标题</label>
        <input type="text" name="title">
    </p>
    <p><label for="content">内容</label>
        <textarea name="content" rows="10" cols="30"></textarea>

    </p>
    <p>
        <button>提交</button>
    </p>
</form>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

PHP代码:

实例

<?php
$t=$_POST['title'];
$c=$_POST['content'];
echo '提交成功','<br>';
echo '标题:',$t,'<br>';
echo '内容',$c;

运行实例 »

点击 "运行实例" 按钮查看在线实例


运行结果图:

image.png

image.png

手写核心代码:

image.png


3.练习流程控制

image.png


image.png


4.练习计数循环

image.png


Correcting teacher:查无此人查无此人

Correction status:qualified

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