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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:57:07+00:00 2026-05-14T23:57:07+00:00

Just getting into PHP web development. I’ve got an HTML form where a user

  • 0

Just getting into PHP web development. I’ve got an HTML form where a user checks some series of dynamically-generated checkboxes, and submits via POST. On the PHP side, I want to check which of the check-boxes were clicked.

I have an array $full_list, and am doing something like

$selected_checkboxes = array_filter($full_list, function($item) {
    array_key_exists($item, $_POST);
  }

I run into problems when a list item is named, for example “Peanut Butter”, since in the POST array it is named “Peanut_Butter”.

I could certainly just str_replace ” ” with “_” before checking array_key_exists, but I imagine that there is a more fundamental encoding problem here; specifically, I’m not sure of exactly what layer transforms normal strings in HTML Forms (value=”Peanut Butter”) into “Peanut_Butter”.

So:

  • what layer is responsible for this conversion? Is it the browser?
  • what are the exact conversion rules, and is there a PHP function out there that will replicate that exact conversion?
  • 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-14T23:57:07+00:00Added an answer on May 14, 2026 at 11:57 pm

    PHP doesn’t do this. There is something on the client side that is converting spaces to underscores.

    The browser should encode each variable using the equivalent of urlencode(). PHP will automatically decode these strings so it is transparent for the programmer.

    edit
    The equivalent in javaScript is escape(). But it is very very likely there is some js code manually converting spaces to underscores.

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

Sidebar

Ask A Question

Stats

  • Questions 496k
  • Answers 496k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There's no point in using Control.InvokeRequired, you know that it… May 16, 2026 at 11:42 am
  • Editorial Team
    Editorial Team added an answer Personally, I use either ANT or Phing for this kind… May 16, 2026 at 11:42 am
  • Editorial Team
    Editorial Team added an answer /usr/local/bin would be the most appropriate location. Mac OS X… May 16, 2026 at 11:42 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm slowly getting back into PHP, and now I run into a problem, I
Just getting into C++. I'm getting constantly thrown off track when I see the
I'm new to Java and just getting into querying databases. So far I have
I'm just getting started with Android app development on a Mac, and I keep
I have spent a lot of time getting into iOS development. I have spent
In the past I've done web application development using Visual Studio. Initially I'd use
The organization I currently work for uses SVN for developing PHP applications. Our development
I've just started working for a new firm as an in-house web developer. Up
I have inherited a broad, ill-designed web portfolio at my job. Most pages are
I've been a PHP developer for many years now, with many tools under my

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.