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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:51:15+00:00 2026-06-14T04:51:15+00:00

I have a simple form that inserts data into a database using foreach($_POST as

  • 0

I have a simple form that inserts data into a database using foreach($_POST as $key=>$value) I have a hidden field on the form

<input name="isset" type="hidden" value="true" />

And i use if(isset($_POST[‘isset’])) {

I’m trying to work out how to exclude the hidden field from the loop …?

I’ve looked at this post but don’t understand where i would use if (strpos($key, ‘hdn_’) == false) // proceed

How to exclude <input type="hidden"> from a for each loop in PHP

any guidance would be appreciated….

  • 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-14T04:51:16+00:00Added an answer on June 14, 2026 at 4:51 am

    If you know the exact names of keys you want to exclude, array_diff_key is a convenient option:

    $keysToRemove = array('isset'); // you can add as many as you want
    $values = array_diff_key($_POST, array_flip($keysToRemove));
    
    foreach ($values as $k => $v) { ... }
    

    However, since $values is intended to go into the database you should use a whitelist of allowed keys instead of a blacklist. You can do that with array_intersect_key:

    $keysToKeep = array('field1', 'field2', 'field3'); // as many as you want
    $values = array_intersect_key($_POST, array_flip($keysToKeep));
    
    foreach ($values as $k => $v) { ... }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple two-field form that stores its data in the database. For
I have a simple form that inserts data in a table on my server.
I have a simple .net windows form which inserts user input into sql database.
I'm trying to create a simple crud form to insert data into a database
So I have a form that can get data from a database by its
I have a simple form that looks like this: <%= simple_form_for @study,:url => studies_path,
I have a simple form that looks like so <% remote_form_for post, :url =>
I have a simple form that searches through the 2000+ issues of a 3rd
So i have a simple form that takes a few inputs (two text and
I currently have a simple form that when you click the save button will

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.