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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:36:40+00:00 2026-06-06T02:36:40+00:00

I have this form: <tbody> <tr> <th>ID</th> <th>Name</th> <th>Birthdate</th> <th><input type=text autofocus=autofocus name=textinput1/></th> <th><input

  • 0

I have this form:

 <tbody>
    <tr>
     <th>ID</th>
     <th>Name</th>
     <th>Birthdate</th>
     <th><input type="text" autofocus="autofocus" name="textinput1"/></th>
     <th><input type="checkbox" name="checkinput[]" value="1"/></th>
    </tr>
    <tr>
     <th>ID</th>
     <th>Name</th>
     <th>Birthdate</th>
     <th><input type="text" autofocus="autofocus" name="textinput2"/></th>
     <th><input type="checkbox" name="checkinput[]" value="1"/></th>
    </tr>
    (...and so on...)
  </tbody>

Is there a way when I click in the submit button, the post data be in a array type, where each index have the checkbox value and the text input? This way I only have to iterate the array and for each row in the form check the respective row in database and update it.

  • 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-06T02:36:43+00:00Added an answer on June 6, 2026 at 2:36 am

    Make the text input boxes into arrays, and put the value for the array keys into your HTML:

    <th><input type="text" autofocus="autofocus" name="textinput[1]"/></th>
    <th><input type="checkbox" name="checkinput[]" value="1"/></th>
    

    Then when you iterate, you do something like this:

    $input = is_array( $_POST['textinput']) ? $_POST['textinput'] : array();
    foreach( $input as $checkbox_value => $text_input_value)
         echo $checkbox_value . ' ' . $text_input_value;
    

    Note that this will not tell you if the checkbox was checked, since only checked checkboxes are sent to the server from the browser. To do this, modify the checkboxes to also include an array key:

    <th><input type="checkbox" name="checkinput[1]" value="1"/></th>
    

    Then, change the foreach loop to this:

    foreach( $input as $checkbox_value => $text_input_value) {
         echo $checkbox_value . ' ' . $text_input_value;
         $checked = (isset( $_POST['checkinput'][$checkbox_value])) ? 'checked' : 'not checked';
         echo "\nThe checkbox was $checked\n";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this form with a date input. echo $this->Form->create('Nodata'); echo $this->Form->input('date1', array('type' =>
I have form like this: <form method=POST> <p> Nazwa kategorii: <br /> <input name=NazwaKat
I have this code: <div id=star-rating> <script type=text/javascript> $(function(){ $('#star-rating form').submit(function(){ $('.test',this).html(''); $('input',this).each(function(){ if(this.checked)
I have a table form like this: <table class=table table-striped table-bordered table-condensed> <tbody> <tr><td><input
I have this form: <form> <div class=box> <h1>Contact form :</h1> <label> <span>Typ: </span> <input
Hi i have this form opening with window's dialog: <form method=GET id=formparam> <table><tbody><tr><td> <label>ID</label></td>
I have this form inside a table: <table id=fields> <form method=post id=accountform></form> <tbody><tr><td class=key>First
I have this form, in which i need to populate a combo box with
I have this form: <%= form_tag posts_path, :method => :get, :class => search_nav do
i have this form to serialize once i click the submit button, <form class=cashier_forms

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.