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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:55:35+00:00 2026-06-05T19:55:35+00:00

Trying to make the infamous checkall checkbox for dynamically created rows from a MySQL

  • 0

Trying to make the infamous checkall checkbox for dynamically created rows from a MySQL query. Rows (and therefore checkboxes) could range from 1 row to a metric buttload.

The form (without the checkall) is as follows:

<form name="form" method="post" action = "process.order.php">

<?php
while($fetch = mysql_fetch_array($order_query){

$order_id = $fetch['oid'];
$order_status = $fetch['ostat'];

?>

   <input type="checkbox" name="order_row[<?=$order_id?>]" id="1" value="1">
   <select name="status[<?=$order_id?>]" id="status[<?=$order_id?>]"
   <option value="Ordered">Ordered</option>
   <option value="Backordered">Backordered</option>
   </select>
<? } ?>


<input type="submit" name="submit" id="submit" value="submit"> </form>

In process.order.php:

<?php
if(is_array($order_row)){
foreach($order_row as $order_id=>$val){

…followed by the rest of the script. I tried using this: How to implement "select all" check box in HTML?
and this:
Select All Checkbox

I’m trying to avoid using jQuery at this moment. Is there a way I can call the checkbox name generated by the PHP script into the javascript code?

Update:
I’d like to use a function that I can call across multiple pages. Thus, calling embedding the form name in the JS won’t be practical for me. Also, I’d like it to be a checkbox – the button’s worked great, but I’m trying to keep the UI simple and I already have a lot of buttons I’m trying to get rid of…

  • 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-05T19:55:36+00:00Added an answer on June 5, 2026 at 7:55 pm

    Working Example

    You can do like this:

    var frm = document.forms['form'];
    for (var i = 0, l = frm.elements.length; i < l; i++) {
       if (frm.elements[i].type === 'checkbox') {
          frm.elements[i].checked = true;
       }
    }
    

    Similarly, to uncheck all set:

    frm.elements[i].checked = true;
    

    to false.

    You can also easily create checkAll and unCheckAll functions using above code.


    By the way, an id with only numeric value is invalid, you should use alpha or mix of alpha and numeric characters.

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

Sidebar

Related Questions

im trying make one replace in string from a array but this dont work
I'm trying make some stuff in jQuery using ASP.NET. But the ID from runat=server
I'm trying make this code which is from a Dictionary of Arrays (CODE) from
Trying to make a make generic select control that I can dynamically add elements
Trying to make a MySQL-based application support MS SQL, I ran into the following
I'm trying make an WPF application that I could copy/cut and paste files info
Trying to make this Reddit-style Voting With PHP, MySQL And jQuery work . Problem:
I am trying make long screen to vertical direction. So, I need a screen
Trying to make a custom :confirm message for a rails form that returns data
trying to make a page which will recursively call a function until a limit

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.