|
<?
header( "Content-Type: text/html; Charset=euc-jp" );
header( "pragma: no-cache" );
header( "Expires: Wed, 31 May 2000 14:59:58 GMT" );
header( "Cache-control: no-cache" );
foreach( $_GET as $Key => $Value ) {
$_POST[$Key] = $_GET[$Key];
}
foreach( $_POST as $Key => $Value ) {
$_POST[$Key] = str_replace("\\'", "'", $_POST[$Key] );
$_POST[$Key] = str_replace("\\\"", "\"", $_POST[$Key] );
}
if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
$Server = 'サーバー';
$DbName = 'データベース';
$User = 'ユーザー';
$Password = 'パスワード';
// 接続
$Connect = @mysql_connect( $Server, $User, $Password );
if ( !$Connect ) {
print "接続エラーです";
exit();
}
// DB選択
mysql_select_db( $DbName, $Connect );
$query = "update 社員マスタ set フリガナ = '{$_POST['fld1']}' where 社員コード = '0001'";
$result = mysql_query($query, $Connect);
// 接続解除
mysql_close($Connect);
// POST された生のデータをファイルへ出力
$data = file_get_contents("php://input" );
file_put_contents("./dump.log", $data );
}
?>
<HTML>
<HEAD>
<META http-equiv="Content-type" content="text/html; charset=euc-jp" />
<TITLE>HTML雛形</TITLE>
<STYLE type="text/css">
* {
font-size: 12px;
}
.column {
border-style:solid;
border-width:1px;
border-color:#000000;
padding: 4px;
}
</STYLE>
</HEAD>
<BODY>
<FORM
name="frm"
method="POST"
action=""
>
<TABLE
border=1
style='
border-collapse:collapse;
border-style:solid;
border-width:1px;
border-color:#000000;
width:690px;
'
>
<TR>
<TD class="column" colspan=2>
<INPUT
type="submit"
name="send"
value="送信"
>
</TD>
</TR>
<TR>
<TD class="column">入力フィールド1</TD>
<TD class="column">
<INPUT
type="text"
name="fld1"
style='width:400px;'
>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
| |