01.
<body>
02.
03.
<article>
04.
<?php
05.
include
"dblink.php"
;
06.
07.
$sql
=
"SELECT * FROM question ORDER BY id DESC"
;
08.
$r
= mysqli_query(
$link
,
$sql
);
09.
while
(
$a
= mysqli_fetch_array(
$r
)) {
10.
11.
12.
echo
'
13.
14.
<div
class
=
"article-container"
>
15.
<span
class
=
"topic"
>
'.$a['
topic
'] . '
</span><br>' .
16.
mb_substr(
$a
[
'detail'
], 0, 120,
'utf-8'
) .
'...<br>'
. '
17.
<a href=
"view-webboard.php?id='.$a['id'].'"
class
=
"readmore"
>อ่านต่อ »</a>
18.
</div>
19.
<br
class
=
"clear"
><br>';
20.
}
21.
22.
23.
?>
24.
</article>
25.
26.
<form id=
"add-question.php"
method=
"post"
>
27.
28.
29.
Topic <input type=
"text"
name=
"topic"
placeholder=
"หัวข้อ *"
required><br>
30.
รายละเอียด
31.
<textarea name=
"content"
placeholder=
"รายละเอียด *"
required></textarea><br>
32.
33.
ชื่อ : <input type=
"text"
name=
"user_id"
value=
"test1"
readonly>
34.
<button type=
"submit"
id=
"submit"
>ส่งข้อมูล</button>
35.
36.
</form>
37.
38.
</div>
39.
</body>
40.
</html>
41.
<?php @mysqli_close(
$link
); ?>