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

  • SEARCH
  • Home
  • 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 6819413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:18:13+00:00 2026-05-26T21:18:13+00:00

I have a form where I added a group of check boxes like below:

  • 0

I have a form where I added a group of check boxes like below:

<form action="next.php" method="get">
<input name="c1" value="1" type="checkbox">
<input name="c1" value="2" type="checkbox">
<input name="c1" value="3" type="checkbox">
<input name="c1" value="4" type="checkbox">
...
</form>

If I select the first and the 3rd check box, the URL looks good when I press the submit button, like

?c1=1&c1=3 [...]

but the $_GET array holds only the last value of c1. I know I could use the [] notation to get an array, but then the link looks like

?c1[]=1&c1[]=3 [...]

I saw sites that generate the URL without the [] and still manage to take all values into account. How do they do that ?

Thank you !

  • 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-26T21:18:14+00:00Added an answer on May 26, 2026 at 9:18 pm

    PHP requires you to use a pseudo-array notation if you want to use the same fieldname for multiple different form elements:

    <input type="checkbox" name="c1[]" ... />
    <input type="checkbox" name="c1[]" ... />
    <input type="checkbox" name="c1[]" ... />
    etc...
    

    The [] tells PHP to treat c1 as an array, and keep all of the submitted values. Without [], PHP will simply overwrite each previous c1 value with the new one, until the form’s done processing.

    Sites which don’t use the [] notation do the form processing themselves, retrieving the query string from $_SERVER['QUERY_STRING'] and then parse it themselves.

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

Sidebar

Related Questions

I have a form that looks like this: <form id=addClassesToDoc action=> <table id=classesTable style=border-collapse:
I have a group of select boxes with different number values that are added
So i have this structure <div class=accordionContent> <form action=/make_requests class=make_request method=post><div style=margin:0;padding:0;display:inline><input name=authenticity_token type=hidden
In Delphi 2010, I have placed 2 radio groups onto a form then added
I have a client that wants to have a custom form added as a
I have added a checker to ensure that all fields in a form have
I have a form in which several buttons are added at runtime via a
I have a form, if submitted correctly, it hides the form. I added a
I have a list within Sharepoint, using a custom new form I have added
I have added an image to my form's resource file, myForm.resx, and I would

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.