<?php 

require_once('../conn.php');

 ?>

<!DOCTYPE html>

<html>

<head>

<meta chaeset="utf-8">

<title>Web</title>

<link rel="stylesheet" type="text/css" href="../style.css">

</head>

<body>

<header>

<h1><a href="../index.php">Web</a></h1>

</header>

<nav>

<ol>

<?php 

$sql = "SELECT * FROM `topic`";

$result = mysqli_query($conn,$sql);

while($row=mysqli_fetch_assoc($result)){

echo '<li><a href="http://localhost/index.php?id='.$row['id'].'">'.htmlspecialchars($row['title']).'</a></li>'."\n";

}

?>

</ol>

</nav>

<article>

<?php

$sql = "SELECT * FROM `topic` WHERE `id`=$id";

$result = mysqli_query($conn,$sql);

$row2=mysqli_fetch_assoc($result);

?>

<form class="" action="modify_check.php" method="POST">

<p>

<label for="title">제목 :</label>

<input type="text" name="title" id="title" value="<?php echo $row2['title'];?>">

</p>

<p>

<label for="description">본문</label>

<textarea id="description" rows="8" cols="40" name="description" value="<?php echo $row2['description'];?>"></textarea>

</p>

<p>

<input type="submit" value="제출">

</p>

</form>

</article>

</body>

</html>


이거인데 글 수정하려고 mysql에서 글 테이블 id를 불러오려고 했는데 안되... 어떻게 해야되 ㅠ 도와줘 형들