プロが教える店舗&オフィスのセキュリティ対策術

フォームに名前、フリ仮名、性別(ラジオボタン)、生年月日(選択メニュー)があり、下記は確認ページで、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>
---

A 回答 (1件)

前に 似たような質問を見た事があったけど



それはただ単にformの部品のタグの閉じ方だとか「"」の閉じ方を誤っていて認識されていないというオチだった。
その辺り、よく確認してみたらどうだろう

この回答への補足

自己レスです。下記の文を削除したらOKでした。
enctype="text/plain"

補足日時:2007/06/08 15:05
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!