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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.