简单的计算功能
效果图
要做出上面的效果图,我们需要对隐藏表单的元素有个简单的了解
隐藏表单的元素的语法格式为:,其功能是在浏览网页时使浏览器不显示这个表单字段元素,但在提交表单时将这个隐藏表单元素的name属性
和value属性值发送给服务器
<span style="color: #000000;">php </span><span style="color: #800080;">$CFQ</span> = <span style="color: #800080;">$_POST</span>["tag"];<span style="color: #008000;">//</span><span style="color: #008000;">判断用户是否单击了计算按钮</span> <span style="color: #0000ff;">if</span>(<span style="color: #800080;">$CFQ</span> == 1<span style="color: #000000;">) { </span><span style="color: #800080;">$addnum1</span> = <span style="color: #800080;">$_POST</span>["addnum1"];<span style="color: #008000;">//</span><span style="color: #008000;">通过$_POST内置数组获取加数</span> <span style="color: #800080;">$addnum2</span> = <span style="color: #800080;">$_POST</span>["addnum2"<span style="color: #000000;">]; } </span><span style="color: #0000ff;">else</span><span style="color: #000000;">{ </span><span style="color: #800080;">$addnum1</span> = <span style="color: #800080;">$addnum2</span> = 0<span style="color: #000000;">; } </span><span style="color: #800080;">$sum</span> = <span style="color: #800080;">$addnum1</span> + <span style="color: #800080;">$addnum2</span><span style="color: #000000;">; </span>?><span style="color: #000000;"> 在表单中输入两个整数 </span>
Copy after login
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

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
1 months ago
By DDD
R.E.P.O. Best Graphic Settings
2 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Assassin's Creed Shadows: Seashell Riddle Solution
1 weeks ago
By DDD
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
