indb.php
<?php header("Content-Type: text/html; charset=utf-8") //UTF-8 설정 ?>
<?php
$host = "localhost"; $user = "mydb"; $password = "db123"; $mydb = mysql_connect($host, $user, $password) or die ("MySQL 연결할 수 없습니다."); if(!mysql_select_db('info', $mydb)) die("데이터베이스를 선택할 수 없습니다.");
$name = $_POST["name"]; // Name(이름) $tel = $_POST["tel"]; $start = $_POST["start"]; $end = $_POST["end"]; $text = $_POST["text"]; // Text(문의내용)
//쿼리를 통해 넘어온 값을 DB에 INSERT 합니다. $sql = "INSERT INTO `info`.`test` (`id` ,`name` ,`tel` ,`start` ,`end` ,`text`) VALUES (NULL, '$name', '$tel', '$start', '$end', '$text')";
mysql_query($sql, $mydb); mysql_close($mydb);
//링크된 페이지로 이동시키며 경고창을 띄웁니다. echo(" <html>
<head> <script name=javascript> location.href='list.php'; </script> </head> </html>
");
|
'php 공부' 카테고리의 다른 글
수정정보 입력 inmod.php (0) | 2014.10.10 |
---|---|
수정폼 mod.php (0) | 2014.10.10 |
회원정보 입력폼 insert.php (0) | 2014.10.10 |
회원정보 list (0) | 2014.10.10 |
NOTEPAD++ 를 이용하여 코딩하자 (0) | 2014.10.09 |