[PHP-users 13625] $BFs<!85G[Ns$N<uEO$K$D$$$F(B
H.Watanabe
php-users@php.gr.jp
Fri, 28 Feb 2003 18:31:06 +0900
$BEOIt!wL$=O<T$H?=$7$^$9!#(B
$B2<5-$h$&$J%F%9%H%3!<%I$r=q$$$?$N$G$9$,!";W$&$h$&$KF0$$$F$/$l$^$;$s!#(B
$B$$$m$$$m$H;n$7$F$$$k$&$A$K!"F,$N@0M}$,$D$+$J$/$J$C$F$7$^$$$^$7$?!#(B
$B$d$j$?$$;v$O!"%U%)!<%`$K%F!<%V%k$N:G2<9T$N%F%-%9%H%\%C%/%9$KCM$rF~NO(B
$B$7!"(BSubmit$B$9$k$H!"%F!<%V%k$KF~NOCM$,DI2C$5$l$k!#(B
$B$r7+$jJV$7!"J#?t9T$N%F!<%V%k$r40@.$5$;$k$H$$$&$b$N$G$9!#(B
$B:,K\E*$K4V0c$C$F$$$k$N$G$7$g$&$+!)(B
$B%"%I%P%$%9$NDx!"$h$m$7$/$*4j$$$7$^$9!#(B
----- sample.php -----
<?php
$nCol = count($array);
$nRow = count($array[0]);
if ($act == "add") {
for($col=0; $col<$nCol; $col++) {
for($row=0; $row<$nRow; $row++) {
$tmp[$col][] = $array[$col][$row];
}
$tmp[$col][] = $new_value[$col];
}
$nRow++;
}
//$B%F!<%V%k$N:n@.(B
$nCol = count($tmp);
$nRow = count($tmp[0]);
echo "<FORM name=table method=POST action=\"./sample.php?act=add\">";
echo "<table border=1>";
echo "<tr><td align=center>$B9`L\(BA</td><td align=center>$B9`L\(BB</td><td align=center>$B9`L\(BC</td></tr>";
for ($row=0; $row<$nRow; $row++) {
for($col=0; $col<$nCol; $col++) {
echo "<tr>";
echo "<td><input name={array[$col][]} type=text size=30 value={$tmp[$col][$row]}></td>";
echo "</tr>";
}
}
//$B?75,F~NOMQ(B
echo "<td><input name=new_value[] type=text size=30 value=\"$B!J$3$3$KF~NO!K(B\"></td>";
echo "<td><input name=new_value[] type=text size=30 value=\"$B!J$3$3$KF~NO!K(B\"></td>";
echo "<td><input name=new_value[] type=text size=30 value=\"$B!J$3$3$KF~NO!K(B\"></td>";
echo "</table>";
echo "<input type=submit value=$BDI2C(B>";
echo "</form>";
?>