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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:14:23+00:00 2026-05-27T15:14:23+00:00

Alright… so on my forms, I am setting all the fields to something like

  • 0

Alright… so on my forms, I am setting all the fields to something like this:

name="formdata['name']" and name="formdata['active']".

Of course, that means whatever is entered in those fields should be stored in $_POST['formdata']['name'] and $_POST['formdata']['active'].

I do my values that way because I pass the ‘formdata’ to a couple of functions I have written (which work as they should.) Now let’s say I’m using this to edit an item or add a new item — the name will go through those functions as it should and the item will save with its name, but ‘active’ will never save as it should. The entry field is a checkbox — if it’s checked, the value is “1”.

If I print_r($_POST['formdata']) after entering ‘Name’ and checking ‘active’, I get this: Array ( ['name'] => Name ['active'] => 1 ).

Looks fine, right? But when I do the following:

if (!isset($_POST['formdata']['active']) echo "Error 1";
if (empty($_POST['formdata']['active']) echo "Error 2";
if ($_POST['formdata']['active'] != 1) echo "Error 3";

They all return errors! I am baffled by this. Am I overlooking something very simple? I have thought about this for at least 2 hours now.

  • 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-05-27T15:14:23+00:00Added an answer on May 27, 2026 at 3:14 pm

    Remove the single quotes from the input names in your HTML so it reads:

    name="formdata[active]"
    

    Adding the single quotes would mean you would have to access the array in PHP as:

    $_POST['formdata']['\'active\'']
    

    or

    $_POST['formdata']["'active'"]
    

    which is highly inconvenient.

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

Sidebar

Related Questions

Alright. I have a query that looks like this: SELECT SUM(`order_items`.`quantity`) as `count`, `menu_items`.`name`
Alright, so I have a query that looks like this: SELECT `orders`.*, GROUP_CONCAT( CONCAT(
Alright so this is a bizarre cross platform thing that I'm experiencing with text
Alright y'all. I am attempting to write a bit of code that places typographic
Alright, so I'm writing this program that essentially batch runs other java programs for
Alright, I am trying to accomplish this: When a user clicks a button that
Alright guys, this should be a very simple request. I'd like to run a
Alright, I found out in this question that polling sockets does not scale, so
Alright so given this graph that must be implemented with the minimum number of
Alright, I hope I can phrase this in a way that makes sense. If

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.