如何从输入名称发布数组值

i want to pass an array value from input name that generated from an array. i can view $_POST if i manually define on script.

   $stmt    = $db->prepare($sql); 
    $stmt->execute();
    $i = 0;
    while ($row = $stmt->fetch())
    {

        $id=strtoupper($row["id"]);
        $nama=strtoupper($row["nama"]);
        $sn=strtoupper($row["sn"]);
        $kewpa=strtoupper($row["kewpa"]);?>



        <form method="post" action="kewpaupdate.php"><tr>
        <td><input type="text" name="id[<?php echo $i;?>]" value=<?php echo $id;?>></td>
        <td></td>
        <td></td>
        <td><input type="text" name="kewpa[<?php echo $i;?>]" value=<?php echo $kewpa;?>></td>
        <td align="center"><input type="submit" value="submit"></td>

        </tr></form>
        <?php ++$i;
    ?>
     </tbody>
    </table>

<?php

$w = $_POST['id'];
$r = $_POST['kewpa'];

echo $w;
echo "<br>";
echo $r;
?>

how to display array value that choose from submit button.

You need to do 2 things:

1) As you are printing the $_POSTed data on the page itself, you need to submit the form to same page.

Please change <form> action to blank.

Changed form action code:

<form method="post" action="">

This will submit the form to same page.

2) As your input has name of type array, you can't just print it with echo or print().

These are used for printing strings.

You need to use print_r().

So, please use:

echo '<pre>';
print_r($_POST['id']);
echo '<pre>';

You will get an array, same for the other field.