フォームに名前、フリ仮名、性別(ラジオボタン)、生年月日(選択メニュー)があり、下記は確認ページで、javascriptを使って、表示されます。でもCGI(以下にあります)では名前のみ取得できあとの値は表示されません。どうすればよいでしょうか
----
<html lang="ja">
<head>
<script type="text/javascript"><!--
function Cng(){
var st = window.opener.document.user.name.value;
window.document.kuser.kname.value = st;
var st1 = window.opener.document.user.furigana.value;
window.document.kuser.kfurigana.value = st1;
var sex=window.opener.document.all.user.sex
if(sex[0].checked)
{window.document.kuser.ksex.value ="男性"}
else if(sex[1].checked)
{window.document.kuser.ksex.value ="女性"}
var st11 = window.opener.document.all.user.year.value;
window.document.kuser.kyear.value = st11;
var st12 = window.opener.document.all.user.month.value;
window.document.kuser.kmonth.value = st12;
var st13 = window.opener.document.all.user.day.value;
window.document.kuser.kday.value = st13;}
//-->
</script>
</head>
<body onLoad="Cng();">
<form name="kuser" action="./5-2.cgi" method="post" enctype="text/plain">
氏名: <input type="text" name="kname" value="" size="30"><br><br>
ふりがな: <input type="text" name="kfurigana" value="" size="30"><br><br>
性別: <input type="text" name="ksex" value="" size="7"><br><br>
生年月日: 西暦 <input type="text" name="kyear" value="" size="10"> 年
<input type="text" name="kmonth" value="" size="5"> 月
<input type="text" name="kday" value="" size="5"> 日<br><br>
<tr><td colspan="2" align="right">
<input type="submit" value="送信">
<input type="button" value="戻る">
-----
(CGI)
#! c:/perl/bin/perl
# フォームデータの取得
if($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $query, $ENV{'CONTENT_LENGTH'});
}
else {
$query = $ENV{'QUERY_STRING'};
}
foreach $pair (split(/&/, $query)){
($key, $value)=split(/=/, $pair);
$value=~tr/+/ /;
$value=~s/%([0-9a-fA-F][0-9a-fA-F])/chr(hex($1))/eg;
$FORM{$key}=$value;
}
# サーバー出力
print <<END;
Content-type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head><title>ふぉーむでーた</title></head>
<body>
<h1>フォームデータ</h1>
<table border="1">
<tr><th>フォーム要素</th><th>データ</th></tr>
END
foreach $key (keys %FORM){
print "<tr><th>$key</th><td>$FORM{$key}</td></tr>\n";
}
print <<END;
</table>
</body>
---
お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!
関連するカテゴリからQ&Aを探す
おすすめ情報
- ・漫画をレンタルでお得に読める!
- ・14歳の自分に衝撃の事実を告げてください
- ・架空の映画のネタバレレビュー
- ・「お昼の放送」の思い出
- ・昨日見た夢を教えて下さい
- ・ちょっと先の未来クイズ第4問
- ・【大喜利】【投稿~10/21(月)】買ったばかりの自転車を分解してひと言
- ・メモのコツを教えてください!
- ・CDの保有枚数を教えてください
- ・ホテルを選ぶとき、これだけは譲れない条件TOP3は?
- ・家・車以外で、人生で一番奮発した買い物
- ・人生最悪の忘れ物
- ・【コナン30周年】嘘でしょ!?と思った○○周年を教えて【ハルヒ20周年】
- ・ハマっている「お菓子」を教えて!
- ・最近、いつ泣きましたか?
- ・夏が終わったと感じる瞬間って、どんな時?
- ・10秒目をつむったら…
- ・人生のプチ美学を教えてください!!
- ・あなたの習慣について教えてください!!
- ・牛、豚、鶏、どれか一つ食べられなくなるとしたら?
- ・都道府県穴埋めゲーム
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
二次元配列を使って順位をだす...
-
画面遷移を行わずに同一ページ...
-
スマホ上で、左右スワイプで次...
-
Outlookのアカウントがあるとメ...
-
Colorboxがうまく設置できません
-
<tr>指定した表の行要素をボ...
-
【GAS】WEBアプリでハイパーリ...
-
GASでチェックボックスを一括of...
-
セレクトボックスで配列を呼び...
-
jqueryのselect2で検索欄の文字...
-
セレクトを全て選択されていな...
-
読み込んだQRコードをフォーム...
-
初心者です。gulpでコンパイル...
-
jquery 診断コンテンツにチェッ...
-
jsで質問です。 ボタンが二つ存...
-
jsonテキストデータの並び替え...
-
食材の期限を管理するためにGAS...
-
前回の質問の続き function mov...
-
このプログラムに、王手をかけ...
-
前回の質問の続き function mou...
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
<tr>指定した表の行要素をボ...
-
階層別の組織図の自動作成について
-
jqueryのselect2で検索欄の文字...
-
初心者です。gulpでコンパイル...
-
スマホ上で、左右スワイプで次...
-
jQueryで同じクラス名のものを...
-
前回の質問の続き function mov...
-
読み込んだQRコードをフォーム...
-
二次元配列を使って順位をだす...
-
セレクトを全て選択されていな...
-
鍵盤アプリで、スマホの画面に...
-
イラストレーター、縦中横のシ...
-
Colorboxがうまく設置できません
-
GASに文字列として関数を入れる...
-
GASでチェックボックスを一括of...
-
その要素がjQueryでremove()済...
-
jsで質問です。 ボタンが二つ存...
-
【Google Apps Script】「ライ...
-
二次元配列の中の各行の要素を...
-
jsonテキストデータの並び替え...
おすすめ情報