Skip to main content

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

Comments

Popular posts from this blog

PHP#33MySQL#29 - Đếm lượt truy cập (KẾT THÚC KHÓA HỌC)

//hitcounter.php <?php session_start();  ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php  include("../connect.php"); //cập nhật số luowhtj truy cập: $sl="update counter set cnt=cnt+1"; mysqli_query($link,$sl); //Lấy dữ liệu số lượt truy cập để hiển thị ra web: $sl2="select * from counter"; $kq=mysqli_query($link,$sl2); $d=mysqli_fetch_array($kq); //Định dạng: $chuoi=str_pad($d['cnt'],6,"0",STR_PAD_LEFT); $luottrycap=""; for($i=0;$i<strlen($chuoi);$i++) { $tam=substr($chuoi,$i,1); $luottrycap.="<img src='images/$tam.png'/>"; } /*-Khi user truy cập vào website: +lần đầu tuy cập: Lưu thông tin của user lên csdl +Sau lần đầu tiên: cập nhtaaj lastvisit - Xóa các dòng dữ liệu quá 1 phút (Quy ước thời gian để khẳng định online hay offline: 1 phút) - Thống kê số liệu người dùng o...

2 (giao diện Visual C#) Solution Explorer

Bài 2 - SOME OTHER TIME - Vào dịp khác