Re: How to get the POST name of a field in a form that uses a counter [message #185935 is a reply to message #185931] |
Thu, 15 May 2014 01:19 |
Denis McMahon
Messages: 634 Registered: September 2010
Karma:
|
Senior Member |
|
|
On Wed, 14 May 2014 23:22:37 +0000, Adrienne Boswell wrote:
> I need to how to get the POST name of a field in a form that uses a
> counter.
You might also want to look at the following example:
<?php
$h=array(20,30,5,10,15);
if(isset($_POST["h"])){
echo "<ul>\n";
for($s=0;$s<count($h);$s++){
if(isset($_POST["h"][$s]))
echo "<li>\$_POST[\"h\"][{$s}] = {$_POST["h"][$s]}</li>\n";
}
echo "</ul>\n";
}
?>
<form method="post">
<?php
for($s=0;$s<count($h);$s++)
echo "<input type=\"text\" name=\"h[{$s}]\" value=\"{$h[$s]}\">";
?>
<input type="submit" value="Submit">
</form>
--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
|
|
|