write.html
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<h2>방명록 작성</h2>
<form action="insert.php" method="post" name="form1">
<table border="1" width="500px">
<tr>
<td>이름</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td>이메일</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td>비번</td>
<td><input type="text" name="passwd"></td>
</tr>
<tr>
<td>내용</td>
<td><textarea name="content" rows="8" cols="40"></textarea></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="전송"></td>
</tr>
</table>
</form>
</body>
</html>
insert.php
<?php
include_once("dbcon.php");
$name =$_POST["name"];
$email =$_POST["email"];
$content=$_POST["content"];
$passwd=$_POST["passwd"];
$sql="
insert into guestbook (name, email, content, passwd, post_date)
values ('$name', '$email', '$content', '$passwd', now())
";
mysql_query($sql);
?>
<script>
location.href="list.php";
</script>
댓글 ( 4)
댓글 남기기