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

Saturday, December 4, 2021

PHP#4 post_bt3 //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 >
<?php
/*
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.
*/

?>
<?php
if(isset($_POST['dong'],$_POST['cot']))
{
$d=$_POST['dong'];
$c=$_POST['cot'];
$m=$_POST['mau'];
echo "<table border='1' width='80%' bgcolor='$m'>";
for($i=1;$i<=$d;$i++)
{
echo "<tr>";
for($j=1;$j<=$c;$j++)
echo "<td>&nbsp;</td>";
echo "</tr>";
}
echo "</table>";

}
else {
?>
<form id="form1" name="form1" method="post" action="">
<p>
<label for="dong">Số dòng:</label>
<input type="text" name="dong" id="dong">
</p>
<p>
<label for="cot">Số cột:</label>
<input type="text" name="cot" id="cot">
</p>
<p>
<label for="mau">Màu nền:</label>
<select name="mau" id="mau">
<option value="blue">Xanh</option>
<option value="red">Đỏ</option>
<option value="yellow">Vàng</option>
</select>
</p>

<p>
<input type="submit" name="taobang" id="taobang" value="Tạo bảng">
</p>
</form>
<?php } ?>
</body>
</html>

0 comments:

Post a Comment