A link for each array value

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dimxasnewfrozen
Forum Commoner
Posts: 84
Joined: Fri Oct 30, 2009 1:21 pm

A link for each array value

Post by dimxasnewfrozen »

I have a form with several check boxes.

The checkbox serves as an array

Code: Select all

<input type="checkbox" value="1"  name="page[]"  /> Checkbox 1 <br/>
<input type="checkbox" value="2"  name="page[]"  /> Checkbox 2 <br/>
...
When I submit the form, I want to display what was checked:

Code: Select all

$page = $_POST['page'];
foreach ($page as $value)
{
   echo $value . "<br />";
}
That displays all of the values that were checked but what I want to happen is show the first value in the array, click next, show the second value of the array (page[2] ?), click next, show the third value (page[3] ?), and so forth untill there are no more values in the array
Post Reply