Tra Từ Điển

Thời gianTiếtThứ 2Thứ 3Thứ 4Thứ 5Thứ 6
8g40 - 9g101Tiếng Việt
Tiếng Anh
Tiếng Việt
Tiếng Việt
9g10 - 9g302Nghỉ giải lao
Tiếng Anh
Nghỉ giải lao
Nghỉ giải lao
9g30 - 10g3Toán
Toán
Toán

Sunday, December 5, 2021

Tạo form cho phép người dùng nhập vào số dòng, số cột và nút thực hiện. Khi người dùng click nút thực hiện, dữ liệu trên form sẽ truyền qua file xử lý và hiển thị 1 bảng có số dòng, số cột tương ứng

//Tạo form cho phép người dùng nhập vào số dòng, số cột và nút thực hiện. Khi người dùng click nút thực hiện, dữ liệu trên form sẽ truyền qua file xử lý và hiển thị 1 bảng có số dòng, số cột tương ứng

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Untitled Document</title>

</head>


<body>

<form action="post2_xuly.php" method="post" id="form2">

  <label>Nhập số dòng:</label>

    <input name="dong" type="text" id="dong" size="30">

  <label>Nhập số cột:</label>

    <input name="cot" type="text" id="cot" size="30">

    <input name="submit" type="submit" id="submit" value="Thực hiện">

</form>

</body>

</html>


//post2_xuly.php

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Untitled Document</title>

</head>


<body>

<?php

if(isset($_POST['dong'],$_POST['cot']))

{

$d=$_POST['dong'];

$c=$_POST['cot'];

?>

<table width="600" border="1">

  <tbody>

  <?php

  for($i=1;$i<=$d;$i++)

{

?>

    <tr>

   <?php

    for($j=1;$j<=$c;$j++)

{

    ?>

      <td>&nbsp;</td>

      <?php } ?>

    </tr>

    <?php } ?>

  </tbody>

</table>

<?php } ?>

</body>

</html>


//CÁCH 2: dùng Mảng để in bảng: https://diendanwebsite.blogspot.com/2021/12/blog-post.html

0 comments:

Post a Comment