Blogger Information
Blog 2
fans 0
comment 0
visits 1417
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
23天作业表格生成器和九九乘法表
phpcn_u60427的博客
Original
696 people have browsed it
demo1.php 表格生成器
<?php
    echo <<<'INPUT'
    <h2>表格生成器</h2>
    <form method="post">
    请输入行:<input type="text" name="rows">
    请输入列:<input type="text" name="cols">
    <button>提交</button>
    </form>
INPUT;
    $rows=isset($_POST['rows'])?$_POST['rows']:0;
    $cols=isset($_POST['cols'])?$_POST['cols']:0;
    echo '<table border="1" cellspacing="0" cellpadding="5">';
        for($i=0;$i<$rows;$i++){
            echo '<tr>';
                for($j=0;$j<$cols;$j++){
                    echo '<td>'.($i*$cols+$j).'</td>';
                }
            echo '</tr>';
        }

    echo '</table>';

demo2.php    九九乘法表


<?php

   echo '<h2>九九乘法表</h2>';
   echo '<table border="0" cellspacing="0" cellpadding="4">';
   for ($i=1;$i<=9;$i++){
       echo '<tr>';
       for ($j=1;$j<=$i;$j++){
           $s=$i*$j;
           echo "<td>$j*$i=$s</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