Home > Backend Development > PHP Tutorial > PHP form request to obtain data summation example_PHP tutorial

PHP form request to obtain data summation example_PHP tutorial

WBOY
Release: 2016-07-13 10:29:42
Original
1123 people have browsed it

Get the value of the form request:

Case:

request.php

Copy code The code is as follows:




Calculate request









[code]
result.php
[code]
$grade=$_REQUEST['grade' ];//grade-->Same as the name value in the form
$arr=explode(" ",$grade);//Split the string with spaces and get the array result
print_r($ arr);
$res=0;
for($i=0;$i$res+=$arr[$i];
}
echo "
ALL=".$res;
echo "
AVG=".(round($res/count($arr),0)); //round(12.334,2)//Rounding method
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/770582.htmlTechArticleGet the value of the form request: Case: request.php Copy the code as follows: html head meta http-equiv=" content-type" content="text/html;charset=utf-8;" /title calculation request/title /h...
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