I'm building a chart, and it's going through a for loop, which creates new text boxes. I want to be able to save the information put in each text box in some sort of variable array.
Right now it's only letting me save the very last one in a variable I've named $memo. I thought that if I echoed $memo within the loop it would print out each text box's input, but it's only taking the last one and printing that to the screen the amount of textboxes that I have.
This is basically the code in the for loop which is in a form:[code=php]
{
<input type="text" size="5" name="memo" id="memo" value="" />
$memo = $_POST['memo'];
echo $memo;
}
<input type="submit" name="Save" value="Save" />[/code]
Is there a way to set up my text input so that I can do some sort of variable array, like [code=php]
<input type="text" size="5" name=$memo[$i] id="memo" value="" />
$i++;[/code]
Any suggestions? Thanks!
-Coco
Right now it's only letting me save the very last one in a variable I've named $memo. I thought that if I echoed $memo within the loop it would print out each text box's input, but it's only taking the last one and printing that to the screen the amount of textboxes that I have.
This is basically the code in the for loop which is in a form:[code=php]
{
<input type="text" size="5" name="memo" id="memo" value="" />
$memo = $_POST['memo'];
echo $memo;
}
<input type="submit" name="Save" value="Save" />[/code]
Is there a way to set up my text input so that I can do some sort of variable array, like [code=php]
<input type="text" size="5" name=$memo[$i] id="memo" value="" />
$i++;[/code]
Any suggestions? Thanks!
-Coco
Comment