Home > php教程 > php手册 > php结合表单实现一些简单功能的例子_php基础

php结合表单实现一些简单功能的例子_php基础

WBOY
Release: 2016-05-17 09:01:16
Original
1254 people have browsed it

例子一(POST提交表单):

复制代码 代码如下:



<br>Chunkify Form <br>



Enter a word:


How long should be the chunks be?








复制代码 代码如下:



<br>Chunkify Word <br>

$word=$_POST['word'];
$number=$_POST['number'];
$chunks=ceil(strlen($word)/$number);
echo "The $number-letter chunks of '$word' are:
\n";
for ($i = 0;$i$chunk=substr($word,$i*$number,$number);
printf("%d: %s
\n",$i+1,$chunk);
}
?>

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template