게시판 리스트 코드...
본문
board.php
<?php
session_start();
?>
<!DOCTYPE HTML>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz" rel="stylesheet">
</head>
<body>
<form method="POST" action="board_process.php?mode=insert">
<div class="board_insert">
<h3>글쓰기</h3>
<span>제목</span><p><input type="text" name="board_title" class="board_title" ></p>
<span>닉네임</span><p><?php echo $_SESSION['usernickname'];?></p>
<span>본문</span><p><textarea rows="20" cols="110" name="board_body" id="" class="board_body" placeholder="글의 본문을 입력해주세요"></textarea></p>
<span>비밀번호</span><p><input tpye="password" name="board_pwd" class="board_pwd"</p>
<input type="submit" value="글쓰기">
<input type="submit" value="취소" onclick=>
</div>
</form>
</body>
</html>
board_process.php
<?php
session_start();
ini_set('display_errors', 1); #에러를 출력
$conn = mysqli_connect("localhost", "root", "root","DORAHEE");
$board_title=$_POST['board_title'];
$board_body=$_POST['board_body'];
$board_pwd=$_POST['board_pwd'];
$usercheck = "SELECT * FROM member WHERE userid ='".$userid."' and userpassword='".$userpassword."'";
if($_GET['mode']==='insert')
{
$board_insert="INSERT INTO topic (board_title,board_body,board_pwd) VALUES('$board_title','$board_body','$board_pwd')";
mysqli_query($conn,$board_insert);
header("Location: board_list.php");
}
board_list.php
<?php
ini_set('display_errors', 1); #에러를 출력
$conn = mysqli_connect("localhost", "root", "root","DORAHEE");
$list_result = mysqli_query($conn,'SELECT * FROM topic');
if(!empty($_GET['id'])) {
$topic_result = mysqli_query($conn,'SELECT * FROM topic WHERE id = '.mysql_real_escape_string($_GET['id']));
$topic = mysqli_fetch_array($topic_result);
}
?>
<html>
<head>
</head>
<body>
<ol>
<?php
while($row = mysqli_fetch_array($list_result)) {
echo "<li><a href=\"?id={$row['id']}\">".htmlspecialchars($row['title'])."</a></li>";}
?>
</ol>
</body>
</html>
이런식으로 코드를 작성했습니다. a태그를 이용해서 게시판 내용을 볼 수 있는 링크를 만들고 싶은대 결과적으로
이러한 화면만 나옵니다....도와주십쇼..
!-->!-->!-->답변 2
echo "<li><a href=\"?id={$row['id']}\">".htmlspecialchars($row['board_title'])."</a></li>";}
title 이 아니라 board_title 인거 같은데요?
"<li><a href=\"?id={$row['id']}&테이블변수=topic\">
답변을 작성하시기 전에 로그인 해주세요.