Blogger Information
Blog 29
fans 0
comment 0
visits 29269
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php简易表单生成器
咸鱼梦
Original
1835 people have browsed it

QQ截图20171227171602.png

代码如下:

//表格生成器
echo <<< 'INPUT'
<form>
请输入行:<input type="text" name="row">列:<input type="text" name="col"><button>提交</button>
</form>
INPUT;

//isset()存在且值不为null,返回:true
$row = isset($_GET['row']) ? $_GET['row'] : null;
$col = isset($_GET['col']) ? $_GET['col'] : null;

echo '<table border="1" cellspacing="0" cellpadding="10">';
	for ($i=0;$i<$row;$i++) {  //$i=0是初始值,$i<=$row 是判断条件是否成立,成立之后每次循环$i自增1;
		echo '<tr>';
		        //$i=0是初始值,$i<=$col 是判断条件是否成立,成立之后每次循环$i自增1;
			for ($j=0;$j<$col;$j++) {  
				echo '<td>'.($i*$col+$j).'</td>';  //
			}
		echo '</tr>';
	}
echo '</table>';


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