日時: 2015/05/16 16:07 名前: lightbox
http://winofsql.jp/php/basic/form/entry.php
result.php
拡張子:
<?php
header("Content-Type: text/html; charset=UTF-8");
// ***********************************************
// デバッグ表示
// ***********************************************
print "<pre>";
print_r( $_POST );
print "</pre>";
print "<hr>";
// ***********************************************
// ファイルに書き込む為の準備作業
// ***********************************************
$abc = $_POST["sei"] . "\n";
$abc .= $_POST["mei"] . "\n";
$abc .= $_POST["jyusyo"] . "\n";
$abc .= $_POST["seibetu"] . "\n";
$abc .= $_POST["smh"] . "\n";
$abc .= $_POST["gk"] . "\n";
// ***********************************************
// 実際の改行コードは変換して出力します
// ***********************************************
$work = str_replace("\r\n","\\r\\n",$_POST["bikou"]);
$work = str_replace("\n","\\n",$work);
$abc .= $work . "\n";
// ***********************************************
// ファイルへ書き込み
// ***********************************************
file_put_contents(
"data.txt",
$abc
);
// ***********************************************
// 表示( セキュリティ対策していません )
// ***********************************************
print $abc;
print "<hr>";
// ***********************************************
// HTML に埋め込む為の準備作業
// ( セキュリティ対策 )
// ***********************************************
$abc = str_replace("\"",""",$abc);
$abc = str_replace("<","<",$abc);
$abc = str_replace(">",">",$abc);
?>
<input
type="text"
name="adr"
value="<?= $abc ?>"
style='width:320px;'>
<br>
<textarea
style="width:320px;height:100px;"><?= $abc ?></textarea>
<br><br>
<a href="entry.php">戻る</a>
|