1002
#!/usr/bin/perl
BEGIN{ $| = 1; print “Content-type: text/html\n\n”; open(STDERR, “>&STDOUT”); }
use CGI;
$query = new CGI;
#前の cgi から受け取った行番号は$edit に入れられます。#########
$edit = $query->param(‘edit’);
#ここでも open 関数#############################
open(IN, “< save.txt”);
@data=<IN>;
close (IN);
########################################
print <<END;
<html>
<head>
<title>データベース 初歩</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=Shift_JIS”>
</head>
<body bgcolor=”#FFFFFF” text=”#000000″>
<div align=”center”>
<h1><b>データベース 初歩</b></h1>
</div>
<hr>
END
###################################################
@cdata=@data[$edit];
###################################################
for($i=0;$i<@cdata;$i++){
@moto=split(/\t/,$cdata[$i]);
};
##################################################
print”<form name=\”form1\” method=\”post\” action=\”iedit.cgi\”>\n”;
print”<p>お名前 <input type=\”text\” name=\”name\” value=\”$moto[5]\”><br>name</p>\n”;
print”<p>住所<input type=\”text\” name=\”add\” value=\”$moto[6]\”><br>address </p>\n”;
print”<p>電話番号<input type=\”text\” name=\”tel\” value=\”$moto[7]\”><br>telephone </p>\n”;
print”<p> メールアドレス <input type=\”text\” name=\”mail\”
value=\”$moto[8]\”><br>e-mail</p>\n”;
print”<p><input type=\”submit\” name=\”submit\” value=\”send\”><input type=\”reset\”
name=\”submit2\” value=\”reset\”></p>\n”;
print”<input type=\”hidden\” name=\”edit\” value=\”$edit\”>\n”;
print”</form>\n”;
print”<hr>\n”;