我想我不太了解,但下面的脚本可能是你想要的。
<?php
$g=$_GET;
if( isset($g['pt']) ){
// the form has been submitted.
$ptValues=$g['pt'];
print_r($ptValues);
}
echo "<form id='ponts'><table>";
for($r=1;$r<=10;$r++)
{
echo "<tr><td> Enter point number$r</td><td> <input type='text' id='pt$r' name='pt[]' pattern='[0-9.]+'/> </td></tr>";
}
echo "</table></form>";
?>
也许是这样:
<?php
$g=$_GET;
if( isset($g['pt0']) ){
// the form has been submitted.
$ptValues=array();
for($i=0; isset($g['pt'.$i]); $i++ )
$ptValues[]=$g['pt'.$i];
print_r($ptValues);
}
echo "<form id='ponts'><table>'";
for($r=1;$r<=10;$r++)
{
echo "<tr><td> Enter point number$r</td><td> <input type='text' id='pt$r' name='pt$r' pattern='[0-9.]+'/> </td></tr>";
}
echo "</table></form>";
?>