フォームに名前、フリ仮名、性別(ラジオボタン)、生年月日(選択メニュー)があり、下記は確認ページで、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を探す
おすすめ情報
- ・漫画をレンタルでお得に読める!
- ・人生のプチ美学を教えてください!!
- ・10秒目をつむったら…
- ・あなたの習慣について教えてください!!
- ・牛、豚、鶏、どれか一つ食べられなくなるとしたら?
- ・【大喜利】【投稿~9/18】 おとぎ話『桃太郎』の知られざるエピソード
- ・街中で見かけて「グッときた人」の思い出
- ・「一気に最後まで読んだ」本、教えて下さい!
- ・幼稚園時代「何組」でしたか?
- ・激凹みから立ち直る方法
- ・1つだけ過去を変えられるとしたら?
- ・【あるあるbot連動企画】あるあるbotに投稿したけど採用されなかったあるある募集
- ・【あるあるbot連動企画】フォロワー20万人のアカウントであなたのあるあるを披露してみませんか?
- ・映画のエンドロール観る派?観ない派?
- ・海外旅行から帰ってきたら、まず何を食べる?
- ・誕生日にもらった意外なもの
- ・天使と悪魔選手権
- ・ちょっと先の未来クイズ第2問
- ・【大喜利】【投稿~9/7】 ロボットの住む世界で流行ってる罰ゲームとは?
- ・推しミネラルウォーターはありますか?
- ・都道府県穴埋めゲーム
- ・この人頭いいなと思ったエピソード
- ・準・究極の選択
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
<tr>指定した表の行要素をボ...
-
初心者です。gulpでコンパイル...
-
階層別の組織図の自動作成について
-
ローディングアニメーションの...
-
食材の期限を管理するためにGAS...
-
前回の質問の続き function mov...
-
このプログラムに、王手をかけ...
-
前回の質問の続き function mou...
-
このプログラムに王様の逃げ道...
-
ビデオのJSについて
-
鍵盤アプリで、スマホの画面に...
-
<div>のタッチ状態を維持したま...
-
jQueryでシンセサイザーを作っ...
-
プログラミング 学習
-
HTMLでサブフレームから親のス...
-
ジャバスクリプトについて。
-
プログラムについて。
-
Q&A掲示板の入力フォームに文字...
-
メールフォームの日付入力フォ...
-
二次元配列を使って順位をだす...
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
食材の期限を管理するためにGAS...
-
ビデオのJSについて
-
前回の質問の続き function mov...
-
このプログラムに、王手をかけ...
-
このプログラムに王様の逃げ道...
-
初心者です。gulpでコンパイル...
-
前回の質問の続き function mou...
-
鍵盤アプリで、スマホの画面に...
-
スマホ上で、左右スワイプで次...
-
jQueryで同じクラス名のものを...
-
読み込んだQRコードをフォーム...
-
追加ボタンを押した際に ok ボ...
-
Colorboxがうまく設置できません
-
階層別の組織図の自動作成について
-
二次元配列を使って順位をだす...
-
【GAS】WEBアプリでハイパーリ...
-
HTMLで作った時報アプリが動き...
-
セレクトを全て選択されていな...
-
画面遷移を行わずに同一ページ...
-
jsで質問です。 ボタンが二つ存...
おすすめ情報