单选按钮上的自动增量名称属性

I have a form that has a set of radio buttons, and I am sending the value of the checked button to another page with php. The form has the option to add another set of the same radio buttons, so if I use the following method of giving name attributes:

<div>
    <input type="radio" name="food[]" value="apple" /> Apple
    <input type="radio" name="food[]" value="orange" /> Orange
</div>

And add a clone of the above,

$_POST['food'];

This would give me the value of each input, and that would total 4. I'm trying to use the bracket incrementing method but still keep the functionality of returning the value of the radio button that was checked.

So my question is, is there a way to use the square brackets to do auto incrementing on the name attribute, but when sending the values to php make sure each div grouping of radio buttons only returns one of the values for whichever one is checked? Please let me know if this question is too vague, this is my first question here.

May i don't understand your question. You can not Auto Incremented the name cause you use radio buttons. By Choosing apple on the first page and orange on the second you will loose your first choose (apple). You can do it with checkboxes instead of radio buttons:

Page 1:

<form method="post" action="page2.php">
<div>
    <input type="checkbox" name="numberofapples" value="1" /> Apple
    <input type="checkbox" name="numberoforanges" value="1" /> Orange
</div>
<input type="submit" value="go">
</form>

Page 2:

<form method="post" action="result.php">
<div>
    <?if($_POST['numberofapples']){?><input type="hidden" name="numberofapples" value="1" /> <?}?>
    <input type="checkbox" name="numberofapples" value="<?=($_POST['numberofapples'])?2:1?>" /> Apple
    <?if($_POST['numberoforanges']){?><input type="hidden" name="numberoforanges" value="1" /> <?}?>
    <input type="checkbox" name="numberoforanges" value="<?=($_POST['numberoforanges'])?2:1?>" /> Orange
</div>
<input type="submit" value="go">
</form>

Result page:

Apples: <?=($_POST['numberofapples'])?$_POST['numberofapples']:0?>
Oranges: <?=($_POST['numberoforanges'])?$_POST['numberoforanges']:0?>

But why don't you do the counting after posting your second page? (add the post values from page 1 as hidden fields to the form of page 2)

If you want to use several div groups with the same input names, I would create them like this:

<div>
    <input type="radio" name="food[0][]" value="apple" /> Apple
    <input type="radio" name="food[0][]" value="orange" /> Orange
</div>
<div>
    <input type="radio" name="food[1][]" value="apple" /> Apple
    <input type="radio" name="food[1][]" value="orange" /> Orange
</div>
<div>
    <input type="radio" name="food[2][]" value="apple" /> Apple
    <input type="radio" name="food[2][]" value="orange" /> Orange
</div>

So, in your PHP, you will have each group in separated keys. For example

print_r( $_POST['food'] );

Should return something like this:

array(
  [0] => array(
    [0] => 'apple'
  ),
  [1] => array(
    [0] => 'orange'
  ), 
  [2] => array(
    [0] => 'apple',
    [1] => 'orange'
  )
)

)