Jump to content

dynamic $_POST data


glenelkins

Recommended Posts

Hi

Ok I have created a quick test script (below) to create 10 dynamic text boxes and a submit button:

[code]
<form name="test" action="test2.php" method="post">
<table>
    <?
    for ($i=0;$i<10;$i++){
        ?>
        <tr>
            <td>
                Email:
            </td>
        </tr>
        <tr>
            <td>
                <input type="text" name="email[$i]">
            </td>
        </tr>
        <?
    }
    ?>
<tr>
    <td>
        <input type="submit" name="button" value="Submit">
    </td>
</tr>
</table>
</form>
[/code]

Now, how do i get the information from each text box?? I tried the following but dont seem to work:

[code]
foreach ($_POST[email] as $email) {
    echo $email . "<br>";
}
[/code]

any ideas people?? cheers

[!--coloro:#CC0000--][span style=\"color:#CC0000\"][!--/coloro--][b]ITS OK FOUND THE PROBLEM ON THIS LINE: <input type="text" name="email[$i]">[/b][!--colorc--][/span][!--/colorc--]
Link to comment
https://forums.phpfreaks.com/topic/10640-dynamic-_post-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.