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

PHP form request to obtain data summation example_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:29:421070browse

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...
Statement:
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