#!/usr/bin/perl #------------------ #program-ID:pet42.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><title>select</title>\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=\"$row[0]\" </td></tr>\n"; print "<tr><th>動物種</th><td><input type=text size=10 name=ianimal value=\"$row[1]\" </td></tr>\n"; print "<tr><th>種類</th><td><input type=text size=40 name=itype value=\"$row[2]\" </td></tr>\n"; print "<tr><th>写真</th><td><input type=text size=15 name=iphoto value=\"$row[3]\"</td></tr>\n"; print "<tr><th>体高</th><td><input type=text size=40 name=iheight value=\"$row[4]\"</td></tr>\n"; print "<tr><th>体重</th><td><input type=text size=40 name=iweight value=\"$row[5]\"</td></tr>\n"; print "<tr><th>性格</th><td><input type=text size=120 name=ichara value=\"$row[6]\"</td></tr>\n"; print "</TABLE>\n"; print "<input type=\"hidden\" name=\"ibangou\" value=".$t0id.">"; if ($t0id){ print "<p><input type=\"submit\" name=UPDATE value=\"更新\">\n"; print "<input type=\"submit\" name=DELETE value=\"抹消\">\n"; } else{ print"<p><input type=\"submit\" name=INSERT value=\"追加\">\n"; } print "</FORM>"; print "<A HREF=\"./pet41.cgi\"戻る"; print "</CENTER>\n"; print "</BODY>\n"; print "</HTML>\n";