<body>
<?php
include_once("ini.php");
$con = mysql_connect(DB_HOST,DB_USER,DB_PASS);
mysql_select_db(DB_NAME);
echo '<form action="index.php" method="post">';
echo '氏名:';
echo '<input type="text" name="name" /><br>';
echo 'メッセージ:';
echo '<input type="text" name="msg" /><br>';
echo '<input type="submit" value="Post" />';
echo '</form>';
$name_d = htmlspecialchars($_POST["name"]);
$msg_d = htmlspecialchars($_POST["msg"]);
$name_d = mb_convert_encoding($name_d,"utf-8");
$msg_d = mb_convert_encoding($msg_d,"utf-8");
if($name_d<>""){
mysql_query("INSERT INTO twi_tb (name,msg) VALUES ('$name_d','$msg_d')");
}
$re = mysql_query("SELECT * FROM twi_tb");
$arr = mysql_fetch_array($re);
for($i=0;$i<count($arr);$i++){
echo $arr[$i][0].$arr[$i][1].$arr[$i][2].$arr[$i][3];
}
mysql_close($con);
?>
</body>