<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.review {
border: 1px solid #ccc;
padding: 10px;
margin-bottom: 20px;
}
* {
box-sizing: border-box;
}
input[type=text], select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
resize: vertical;
}
label {
padding: 12px 12px 12px 0;
display: inline-block;
}
input[type=submit] {
background-color: #04AA6D;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
float: right;
}
input[type=submit]:hover {
background-color: #45a049;
}
.container {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
.col-25 {
float: left;
width: 25%;
margin-top: 6px;
}
.col-75 {
float: left;
width: 75%;
margin-top: 6px;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
.col-25, .col-75, input[type=submit] {
width: 100%;
margin-top: 0;
}
}
</style>
</head>
<body>
<h2>?ÓNG GÓP</h2>
<p>Hãy ?óng góp ý ki?n c?a b?n bên d??i.</p>
<div class="container">
<form method="post">
<div class="row">
<div class="col-25">
<label for="fname">H? Và Tên</label>
</div>
<div class="col-75">
<input type="text" id="fname" name="firstname" value='' placeholder="Your name.." required>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="lname">?T Liên L?c</label>
</div>
<div class="col-75">
<input type="text" id="lname" value='' name="dt" placeholder="Mobile...090." required>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="lname">Ngày Tháng</label>
</div>
<div class="col-75">
<input type="text" id="lname" name="date" value="<?php echo date('d-m-Y') ?>" placeholder="ngày ?óng góp"required>
</div>
</div>
<!--
<div class="row">
<div class="col-25">
<label for="country">Country</label>
</div>
<div class="col-75">
<select id="country" name="country">
<option value="australia">Australia</option>
<option value="canada">Canada</option>
<option value="usa">USA</option>
</select>
</div>
</div>
-->
<div class="row">
<div class="col-25">
<label for="subject">Nh?n xét, ?ánh giá</label>
</div>
<div class="col-75">
<textarea id="subject" name="subject" placeholder="Write something.." style="height:200px"></textarea>
</div>
</div>
<div class="row">
<div class="col-25">
<label for="lname">Mã xác nh?n</label>
</div>
<div class="col-75">
<input type="text" id="lname" name="xn" value="" placeholder="nguyentrac"required>
</div>
</div>
<div class="row">
<input type="submit" value="submit" name="submit">
</div>
</form>
</div>
<?php
$filename = "datar.php";
$fp1 = fopen($filename, 'a');//m? file ? ch? ?? write-only
$line= file($filename);
if (isset($_POST['submit']))
{
$firstname = $_POST['firstname'];
$dt = $_POST['dt'];
$date = $_POST['date'];
$subject=trim(preg_replace('/\s\s+/', ' ', $_POST['subject'])); //trim(preg_replace('/\s\s+/', ' ', $_POST['tin'])); $_POST['subject']
$xn = $_POST['xn'];
$submit = $_POST['submit'];
/*
echo "KN thanh cong";
echo "<pre>";
print_r($_POST);
*/
if ($xn=="nguyentrac"){ //mã xác nh?n ?? l?u
$maid='nt'.(int)count($line);
date_default_timezone_set('Asia/Ho_Chi_Minh');
$date = date('d-m-y h:i:s');
$data = "$firstname nhc $dt nhc $date nhc $subject nhc $maid nhc $date \n";
fwrite($fp1, $data);
fclose($fp1);
echo '<script>alert("Chúng tôi ?ã nh?n ???c tin c?a b?n, chúng tôi s? h?i ?áp s?m ?T: 0985.36.54.64")</script>';
} else {echo '<script>alert("Tin ch?a ???c g?i, hãy ?i?n ?úng mã xác nh?n: nguyentrac ho?c liên h? ?T: 0985.36.54.64")</script>';}
}
else {echo ".";}
echo '<h2>XIN ?? L?I ?ÓNG GÓP BÊN D??I</h2><br>';
echo "<div class='review'>";
$k=1;
for ($row = (int)count($line)-1; $row >= 0 ; $row--) {
echo '<b>Tên: '.explode('nhc',$line[$row])[0].'|| ?T: '.explode('nhc',$line[$row])[1].'</b><br>';
echo '   '.explode('nhc',$line[$row])[2].'<br>';
echo '   '.explode('nhc',$line[$row])[3].'<br><br>';
}
echo "</div>";
/*
echo "<div class='review'>";
echo "<h3> dfgdfgdfgdfg </h3>";
echo "<h3> dfgdfgdfgdfg </h3>";
echo "<h3> dfgdfgdfgdfg </h3>";
echo "<h3> dfgdfgdfgdfg </h3>";
echo "<h3> dfgdfgdfgdfg </h3>";
echo "<h3> dfgdfgdfgdfg </h3>";
echo "<h3> dfgdfgdfgdfg </h3>";
echo "<p> gfjhgfhg hfghgfh gfh gfh </p>";
echo "</div>";
*/
?>
</body>
</html>
|