/********************************************************/
/* WEBデータベース入門 - PHPスクリプト */
/* アンケートをデータベースに登録する */
/******************/
/* データチェック */
if( $sample == "" || $phpfi == "" || $rdbms == "" || $whole == "" ) {
echo "未記入の入力項目があります。[←]ボタンで戻って入力してください。
";
exit;
}
/*********************/
/* MySQLへデータ登録 */
$result = mysql_db_query("questions",
"insert into www_db (" .
" register, email, how_old, sex, ocupation," .
" sample,phpfi,rdbms,whole )" .
"values (" .
" '$register', '$email', $how_old, $sex, $ocupation," .
" $sample, $phpfi, $rdbms, $whole ) "
);
/**********************/
/* 確認画面表示用処理 */
if( $register == "" ) { $register = "無記名"; }
if( $email == "" ) { $email = "無記名"; }
if( $sex == 1 ) { $sex = "男"; } else { $sex = "女"; }
$ocupation_str[1] = "学生";
$ocupation_str[2] = "プログラマー";
$ocupation_str[3] = "ネットワークエンジニア";
$ocupation_str[4] = "アプリケーションエンジニア";
$ocupation_str[5] = "システムアナリスト";
?>
アンケート登録内容確認画面
お答えいただいたアンケートは以下のように登録されました。どうもありがとうございます。
氏名: echo $register ?>
電子メールアドレス: echo $email ?>
年齢: echo $how_old ?>歳台
性別: echo $sex ?>
職業: echo $ocupation_str[$ocupation] ?>
項目 | 難易度 |
サンプル解説は | echo $sample ?> |
PHP解説は | echo $phpfi ?> |
RDBMS解説は | echo $rdbms ?> |
全体は | echo $whole ?> |
※大変分かりやすい(1)〜大変難しい(5)