Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4334876
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:35:36+00:00 2026-05-21T10:35:36+00:00

Excuse me, but I have no idea what this is called, so I’ll try

  • 0

Excuse me, but I have no idea what this is called, so I’ll try and explain it.

With HTML forms you can have input fields of the same name, with auto assigning keys for each one, for example:

<form action="somepage" method="post">
<input type="text" name="phone[]" />
<input type="text" name="phone[]" />
<input type="submit" />
</form>

when this form is submitted, the server receives the data in via POST.

as an associative array it looks like this:

Array(
[phone] => Array ( [0] => 123456789 [1] => 987654321 )
)

where keys 0,1 are given automatically.

how would you do the same with radio fields?

<input type="radio" name="option[]"/>
<input type="radio" name="option[]"/>

is treating both fields as one (as it should) and not giving it unique keys…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:35:36+00:00Added an answer on May 21, 2026 at 10:35 am

    As far as HTML is concerned, fields with the same name are just fields with the same name. Radio buttons are a special case in that sharing a name makes them part of a group and only one may be selected.

    In most form handling libraries, you can get data from multiple elements with the same name presented as an array.

    In PHP, you can only get the data presented as an array if the name ends with [] (or [something] for arrays with predefined indexes).

    Only checked radio buttons can be successful and only one radio button in a group can be checked (that is the point of radio buttons).

    If you want the user to pick multiple options, use checkboxes. If you give those checkboxes the same name and end it with [] then PHP will get all the values of the checked checkboxes in a single array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Excuse the n00bness of this question, but I have a web application where I
Excuse the 'noob' question, but can someone please explain the way ASP.NET's buttons work.
Please excuse my ignorance, but I have come across this term owner drawn listbox.
Please excuse the simplicity and length of this, but I have a little test
Please excuse my lack of knowledge on the topic, but I have very little,
Excuse me if this is a silly question but i'm a beginer here. I
Excuse the poor phrasing, I know it's possible but I can't figure out what
Excuse if this is more a file format conversion question rather than programming, but
Please excuse (or improve the title) but I have a silly little problem that's
I will try to explain my problem clearly: I have two tables: document and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.