|
|
<HTML>
<HEAD>
<META http-equiv="Content-type" content="text/html; charset=utf-8" />
<TITLE>社員マスタメンテメニュー</TITLE>
<STYLE type="text/css">
* {
font-size: 12px;
}
.column {
border-style:solid;
border-width:1px;
border-color:#000000;
padding: 4px;
}
</STYLE>
<SCRIPT language="javascript" type="text/javascript">
</SCRIPT>
</HEAD>
<BODY>
<pre>
1. <a href="pass1.php?mode=1">新規</a>
2. <a href="pass1.php?mode=2">修正</a>
3. <a href="pass1.php?mode=3">削除</a>
</pre>
</BODY>
</HTML>
| |
|
|
|
|
<?
header( "Content-Type: text/html; Charset=utf-8" );
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 ( $_POST['mode'] == 1 ) {
$mode_message = '新規';
}
if ( $_POST['mode'] == 2 ) {
$mode_message = '修正';
}
if ( $_POST['mode'] == 3 ) {
$mode_message = '削除';
}
?>
<HTML>
<HEAD>
<META http-equiv="Content-type" content="text/html; charset=utf-8" />
<TITLE>社員マスタメンテ : キー入力</TITLE>
<STYLE type="text/css">
* {
font-size: 12px;
}
.column {
border-style:solid;
border-width:1px;
border-color:#000000;
padding: 4px;
}
.mode_message {
color:red;
font-weight:bold;
}
</STYLE>
<SCRIPT language="javascript" type="text/javascript">
// *********************************************************
//
// *********************************************************
function checkForm( ) {
if ( !confirm( "サーバーへ送信しますか? " ) ) {
return false;
}
return true;
}
</SCRIPT>
</HEAD>
<BODY>
<A href="menu.php">戻る</A>
<FORM
name="frm"
method="GET"
action="pass2.php"
onSubmit='return checkForm();'
>
<INPUT type="hidden" name="mode" value="<?= $_POST['mode'] ?>">
<TABLE
border=1
style='
border-collapse:collapse;
border-style:solid;
border-width:1px;
border-color:#000000;
width:200px;
'
>
<TR>
<TD class="column" colspan=2>
<INPUT
type="submit"
name="send"
value="送信"
>
<SPAN class="mode_message"><?= $mode_message ?></SPAN>
</TD>
</TR>
<TR>
<TD class="column">社員コード</TD>
<TD class="column">
<INPUT
type="text"
name="fld1"
value="<?= $_POST['fld1'] ?>"
style='width:60px;'
>
</TD>
</TR>
</TABLE>
</FORM>
<pre>
▼デバッグ用
<? print_r($_POST) ?>
</pre>
</BODY>
</HTML>
| |
|
|
|
|
<?
header( "Content-Type: text/html; Charset=utf-8" );
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 ( substr(PHP_OS,0,3) == 'WIN' ) {
if ( !extension_loaded( "mysql" ) ) {
dl("php_mysql.dll");
}
}
$Server = 'localhost';
$DbName = 'lightbox';
$User = 'root';
$Password = 'password';
// 接続
$Connect = @mysql_connect( $Server, $User, $Password );
if ( !$Connect ) {
print "接続エラーです";
exit();
}
// DB選択
mysql_select_db( $DbName, $Connect );
// クエリ
if ( $_POST['mode'] == 2 ) {
// 文字列中の ' は '' に変更
$_POST['fld1'] = str_replace("'","''",$_POST['fld1']);
$query = "select * from 社員マスタ";
$query .= " where 社員コード = '{$_POST['fld1']}'";
$result = mysql_query($query, $Connect);
$row = mysql_fetch_array($result);
if ( $row ) {
$_POST['fld2'] = $row['氏名'];
}
else {
print "対象データが存在しません";
mysql_close($Connect);
exit();
}
}
// 接続解除
mysql_close($Connect);
// *********************************************************
// 更新処理 の終了
// *********************************************************
if ( $_POST['mode'] == 1 ) {
$mode_message = '新規';
}
if ( $_POST['mode'] == 2 ) {
$mode_message = '修正';
}
if ( $_POST['mode'] == 3 ) {
$mode_message = '削除';
}
?>
<HTML>
<HEAD>
<META http-equiv="Content-type" content="text/html; charset=utf-8" />
<TITLE>社員マスタメンテ : 明細入力</TITLE>
<STYLE type="text/css">
* {
font-size: 12px;
}
.column {
border-style:solid;
border-width:1px;
border-color:#000000;
padding: 4px;
}
.mode_message {
color:red;
font-weight:bold;
}
</STYLE>
<SCRIPT language="javascript" type="text/javascript">
// *********************************************************
//
// *********************************************************
function checkForm( ) {
if ( !confirm( "サーバーへ送信しますか? " ) ) {
return false;
}
return true;
}
</SCRIPT>
</HEAD>
<BODY>
<A href="pass1.php?mode=<?= $_POST['mode'] ?>&fld1=<?= $_POST['fld1'] ?>">戻る</A>
<FORM
name="frm"
method="GET"
action="pass3.php"
onSubmit='return checkForm();'
>
<INPUT type="hidden" name="mode" value="<?= $_POST['mode'] ?>">
<TABLE
border=1
style='
border-collapse:collapse;
border-style:solid;
border-width:1px;
border-color:#000000;
width:300px;
'
>
<TR>
<TD class="column" colspan=2>
<INPUT
type="submit"
name="send"
value="送信"
>
<SPAN class="mode_message"><?= $mode_message ?></SPAN>
</TD>
</TR>
<TR>
<TD class="column">社員コード</TD>
<TD class="column">
<INPUT
type="text"
name="fld1"
value="<?= $_POST['fld1'] ?>"
readonly
style='width:60px;background-color:silver'
>
</TD>
</TR>
<TR>
<TD class="column">社員名</TD>
<TD class="column">
<INPUT
type="text"
name="fld2"
value="<?= $_POST['fld2'] ?>"
style='width:200px;'
>
</TD>
</TR>
</TABLE>
</FORM>
<pre>
▼デバッグ用
<? print_r($_POST) ?>
</pre>
</BODY>
</HTML>
| |
|
|
|
|
<?
header( "Content-Type: text/html; Charset=utf-8" );
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 ( $_POST['mode'] == 1 ) {
$mode_message = '新規';
}
if ( $_POST['mode'] == 2 ) {
$mode_message = '修正';
}
if ( $_POST['mode'] == 3 ) {
$mode_message = '削除';
}
$back_query_string = "mode=" . $_POST['mode'];
$back_query_string .= "&fld1=" . $_POST['fld1'];
$back_query_string .= "&fld2=" . urlencode($_POST['fld2']);
?>
<HTML>
<HEAD>
<META http-equiv="Content-type" content="text/html; charset=utf-8" />
<TITLE>社員マスタメンテ : 確認画面</TITLE>
<STYLE type="text/css">
* {
font-size: 12px;
}
.column {
border-style:solid;
border-width:1px;
border-color:#000000;
padding: 4px;
}
.mode_message {
color:red;
font-weight:bold;
}
</STYLE>
<SCRIPT language="javascript" type="text/javascript">
// *********************************************************
//
// *********************************************************
function checkForm( ) {
if ( !confirm( "★★★ 更新しますか? " ) ) {
return false;
}
return true;
}
</SCRIPT>
</HEAD>
<BODY>
<A href="pass2.php?<?= $back_query_string ?>">戻る</A>
<FORM
name="frm"
method="GET"
action="pass4.php"
onSubmit='return checkForm();'
>
<INPUT type="hidden" name="mode" value="<?= $_POST['mode'] ?>">
<TABLE
border=1
style='
border-collapse:collapse;
border-style:solid;
border-width:1px;
border-color:#000000;
width:300px;
'
>
<TR>
<TD class="column" colspan=2>
<INPUT
type="submit"
name="send"
value="更新"
style='color:#ffffff;background-color:#0000ff;'
>
<SPAN class="mode_message"><?= $mode_message ?></SPAN>
</TD>
</TR>
<TR>
<TD class="column">社員コード</TD>
<TD class="column">
<INPUT
type="text"
name="fld1"
value="<?= $_POST['fld1'] ?>"
readonly
style='width:60px;border solid 0 #ffffff;'
>
</TD>
</TR>
<TR>
<TD class="column">社員名</TD>
<TD class="column">
<INPUT
type="text"
name="fld2"
value="<?= $_POST['fld2'] ?>"
readonly
style='width:200px;border solid 0 #ffffff;'
>
</TD>
</TR>
</TABLE>
</FORM>
<pre>
▼デバッグ用
<? print_r($_POST) ?>
</pre>
</BODY>
</HTML>
| |
|
|
|
|
<?
header( "Content-Type: text/html; Charset=utf-8" );
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 ( substr(PHP_OS,0,3) == 'WIN' ) {
if ( !extension_loaded( "mysql" ) ) {
dl("php_mysql.dll");
}
}
$Server = 'localhost';
$DbName = 'lightbox';
$User = 'root';
$Password = 'password';
// 接続
$Connect = @mysql_connect( $Server, $User, $Password );
if ( !$Connect ) {
print "接続エラーです";
exit();
}
// DB選択
mysql_select_db( $DbName, $Connect );
// クエリ
if ( $_POST['mode'] == 2 ) {
// 文字列中の ' は '' に変更
$_POST['fld1'] = str_replace("'","''",$_POST['fld1']);
$_POST['fld2'] = str_replace("'","''",$_POST['fld2']);
$query = "update 社員マスタ set 氏名 = '{$_POST['fld2']}'";
$query .= " where 社員コード = '{$_POST['fld1']}'";
}
$result = mysql_query($query, $Connect);
// 接続解除
mysql_close($Connect);
// *********************************************************
// 更新処理 の終了
// *********************************************************
if ( $_POST['mode'] == 1 ) {
$mode_message = '新規';
}
if ( $_POST['mode'] == 2 ) {
$mode_message = '修正';
}
if ( $_POST['mode'] == 3 ) {
$mode_message = '削除';
}
?>
<HTML>
<HEAD>
<META http-equiv="Content-type" content="text/html; charset=utf-8" />
<TITLE>社員マスタメンテ : 更新結果</TITLE>
<STYLE type="text/css">
* {
font-size: 12px;
}
.column {
border-style:solid;
border-width:1px;
border-color:#000000;
padding: 4px;
}
</STYLE>
<SCRIPT language="javascript" type="text/javascript">
</SCRIPT>
</HEAD>
<BODY>
<pre>
<a href="menu.php"><?= $mode_message ?> 処理が正常に終了しました</a>
</pre>
<pre>
▼デバッグ用
<? print_r($_POST) ?>
</pre>
</BODY>
</HTML>
| |
|
|
|