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 8929835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:45:33+00:00 2026-06-15T08:45:33+00:00

I have a group of checkboxes using this syntax: echo <form name=\myform\ method=\POST\ action=\csvbuilder.php\>;

  • 0

I have a group of checkboxes using this syntax:

echo "<form name=\"myform\" method=\"POST\" action=\"csvbuilder.php\">";
echo "<input type=\"checkbox\" name=\"list[]\" value=\"".$res['id']."\" />";

At the bottom I have a “Check all” button..

echo "<input type=\"button\" name=\"UnCheckAll\" value=\"Uncheck All\" onClick=\"uncheckAll(document.myform.list)\" />

Which refers to the following JS script..

function checkAll(field) {
  for (i = 0; i < field.length; i++)
    field[i].checked = true ;
}

Here’s the problem:
The check all button only works when I remove the square brackets from the input name, ie name="list" as opposed to name="list[]". I need the brackets, or else the PHP form handler won’t work. I have tried adding the brackets to the JS, ie onClick="uncheckAll(document.myform.list[])" but that doesn’t work either.

How do I get JS and PHP to play nicely?

Thanks to all responders. I especially appreciate any references/explanations/jfiddles.

  • 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-06-15T08:45:34+00:00Added an answer on June 15, 2026 at 8:45 am

    It can be accessed with document.myform['list[]']:

    echo "<input type=\"button\" name=\"UnCheckAll\" value=\"Uncheck All\" onClick=\"uncheckAll(document.myform['list[]'])\" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jQuery 1.4.3. I have a group of checkboxes like this: <input
I have 4 group of checkboxes, in which i am grouping all this 4
I have a form that has a group of 13 checkboxes that together make
I have a dropdown list with a few options and a group of checkboxes
currently in my update controller method I have: @group.attributes = { :title => params[:group][:title],
I have a group of radio with an onchange handler: <input type=radio name=Q12 value=radio
I am trying to have a checkboxes validation using Javascript, and i am really
Can you please help me format this simple_form? I am using this form: <%=
I have a form with X number of groups of checkboxes with price values.
I have a web form using custom validators (to set textbox borders to red)

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.