Blogger Information
Blog 3
fans 0
comment 0
visits 2446
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
表格生成器
蔚蓝的彼岸
Original
766 people have browsed it

下面的代码主要是实现一用户输入行和列,生成对应的表格

<?php
header('content-type:text/html;charset=utf-8');
echo <<<'INPUT'
<div align="center">
<form>
请输入表格的: <br>行:<input type="text" name="row">列:<input type="text" name="col">
<button>提交</button>
</form>
</div>
INPUT;

isset($_GET['row'])?$row = $_GET['row']:$row ='1';
isset($_GET['col'])?$col = $_GET['col']:$col ='1';
echo '<table border="1" cellpadding="0" cellspacing="0" width="100px" align="center" >';
for($i=0;$i<$row;$i++){
   echo '<tr>';
   for($j=0;$j<$col;$j++){
//        echo '<td>'.($i*$col+$j).'</td>';
       echo '<td style="width: 10px"><textarea rows="2" cols="8" style="resize: none" ></textarea></td>';
   }
   echo '</tr>';
}



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