#!/usr/bin/perl #------------------ #program-ID:pet43.cgi #auther :t-egi #date :2002/2/5 #------------------ use CGI; use DBI; $query = new CGI; $t0id = $query->param('ibangou'); print "Content-Type: text/html\n\n"; #------------------- $username="egi"; if($t0id){ $dbh = DBI->connect("dbi:Pg:dbname=egi",$username) or die "Cannot connect:",$DBI->errstr; $iSelect = "Select bangou, animal, type, photo, height, weight, chara from pet_list where bangou=?"; $sth = $dbh->prepare($iSelect) or die "Cannot prepare:",$dbh->errstr(); $sth->execute($t0id) or die "Cannot execute: " , $sth->errstr(); } #------------------- print "<html>\n"; print "<head>select \n"; print "<meta http-equiv=\"content-type\" content=\"text/html;charset=x-euc-jp\">\n"; print "</head>\n"; print "<body bgcolor =LINEN>\n"; print "<center>\n"; print "<h5>\n"; print "<I>追加画面</I>\n"; print "<FORM ACTION=\"./pet44.cgi\" METHOD=\"post\">"; print "<TABLE BORDER = 1 bgcolor =SKYBLUE>\n"; if($t0id){ @row = $sth->fetchrow_array(); } print "<tr><th>番号</th><td><input type=text size=2 name=ibangou value=\"\" </td></tr>\n"; print "<tr><th>動物種</th><td><input type=text size=10 name=ianimal value=\"\" </td></tr>\n"; print "<tr><th>種類</th><td><input type=text size=40 name=itype value=\"\" </td></tr>\n"; print "<tr><th>写真</th><td><input type=text size=15 name=iphoto value=\"\"</td></tr>\n"; print "<tr><th>体高</th><td><input type=text size=40 name=iheight value=\"\"</td></tr>\n"; print "<tr><th>体重</th><td><input type=text size=40 name=iweight value=\"\"</td></tr>\n"; print "<tr><th>性格</th><td><input type=text size=120 name=ichara value=\"\"</td></tr>\n"; print "</TABLE>\n"; if ($t0id){ print "<p><INPUT TYPE=\"submit\"name=UPDATE value=\"更新\">\n"; print "<p><INPUT TYPE=\"submit\"name=DFLETE value=\"抹消\">\n"; } else{ print "<p><input type=\"submit\" name=INSERT value=\"追加\">\n"; } print "</FORM>"; print "<A HREF=\"./pet41.cgi\">戻る</A>"; print "</CENTER>\n"; print "</BODY>\n"; print "</HTML>\n";