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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:12:21+00:00 2026-06-04T06:12:21+00:00

I have a problem with a particular array in a checkbox input. $insert .=

  • 0

I have a problem with a particular array in a checkbox input.

$insert .= '<tr>
<td>' .$uname. '</td>
<td>' .$fname. '</td>
<td>' .$lname. '</td>
<td>' .$email. '</td>
<td>'.(($admin == 'y') ? 'Admin':'User').'</td>
<td><input type="checkbox" name="change['.$uid.']" 
           value="'.(($admin == 'y')?'n':'y').'"/>'
                   .(($admin == 'y')?'Make a user':'Make an admin user').'</tr>';

From what i’ve been reading, this should create an array that can be run through if there are multiple checkbox. The $uid is the user id and the name displays as change[1], change[2] etc.. and this works.

The problem is when i run this through a while statement like so:

while(list($key, $val) = each($_POST['change'])) {

I get this message:

Warning: Variable passed to each() is not an array or object

Does anyone know why this may be happening and how to solve 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-04T06:12:23+00:00Added an answer on June 4, 2026 at 6:12 am

    Your array is not being created when submitted. I took your code and made the required form etc.

    var_dump($_POST['change']); returns NULL, even when I remove the $uid.

    I wish I could tell you why, but it looks like it ‘should’ work to me.
    I suggest cleaning up your code, taking out the ternary operators to something more aesthetically pleasing, then double checking your quotes. PHP hates single quotes, even when they should theoretically work, like in the parameter of your POST array (‘change’) , it is possible the quotes are confusing it.

    Well PHP doesn’t hate single quotes, you just have to be careful with them as if they are used incorrectly it means code will not be parsed…

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

Sidebar

Related Questions

I have a problem downloading particular file types by WebClient. So there are no
i have this problem to find a particular xml node l have post this
I have a problem; I'm using an external library where one particular event has
I have a problem with <h:inputText> . In particular I have a series of
In my particular situation, I have a couple of solutions to my problem. I
PROBLEM I have a nested PHP array that I need to populate from flat
I have a structure in my program that contains a particular array. I want
The problem is like this: I have an array of 500 pointers which point
I have a UITableView which is populated with an array of objects of type
I have an optimization problem as follows. Given an array of positive integers, e.g.

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.