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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:42:51+00:00 2026-06-13T08:42:51+00:00

I have a form as shown below. What I have done up to now

  • 0

I have a form as shown below.

checkbpxes

What I have done up to now is assign a checkbox for each item as follows.

<input type="checkbox" name="options[]" value="relevant_value" class="checks">

Now my issue is I can not figure out which the parent item and which is the child item. How can I solve this?

(Given I use Joomla. Get the checkboxes using below code)

$options    = JRequest::getVar('options', NULL, 'post', 'array');
  • 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-13T08:42:52+00:00Added an answer on June 13, 2026 at 8:42 am

    I’ll suggest to use multidimensional array.like this-

    For parent-
    <input type="checkbox" name="options[]" value="parent" class="checks">
    For child-
    <input type="checkbox" name="options[parent][]" value="child" class="checks">
    

    get data through-

    $options    = JRequest::getVar('options', NULL, 'post', 'array');
    

    see how data comes-

    print_r($options);
    

    Now it’s two dimentional,use parent as the key for child to differentiate different parent.

    foreach($options as $option){
             $parent[] = $option;
             if(is_array($options[$option]){
                 foreach($options[$option] as $opt)
                 $childs[$option][]=$opt;
             }
    
        }
    

    let me know if it’s not clear.

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

Sidebar

Related Questions

I have one form as shown below: Page 1: <form name = form1 method=post
I have built a simple registration form shown below and Iam trying to get
I have a form like below I need to create an array for each
I have a script.I will show sample. <form> <textarea id='input'></textarea> <input onclick=convert() value=go function
I have a select query in MySQL shown below: This query executes and produces
I have an HTML form with an input field to upload a file. I
I have added a button as shown in the code below, I have added
I have a field name varaince in a table set to type Number(20,3) in
I am Planning to implement a form validation in android. I have done empty
I have a form that has input fields that dont' map to a model

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.