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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:07:20+00:00 2026-05-16T22:07:20+00:00

I have a form that allows the user to add information an their leisure.

  • 0

I have a form that allows the user to add information an their leisure. They can add locations via jQuery in my form so when recieving the data I may have 1 location or 10. Each location has attributes like phone, address, etc. In my form the input names are appended with _1 , _2, etc to show its a new set of data. That is working swimmingly and I just can’t seem to find these keys when looping through the $_POST array

private function array_pluck($arr,$text)
    {
        foreach($arr as $key => $item)
        {
            if(stripos($key,$text) != 0)
            {
                $found[] = $item;
            }
        }
        return $found;
    }

As I understand it if my array has some keys “office_branch_phone_1, office_branch_phone_2” I should be able to put in “office_branch” in my $text param and it will spit out any keys with the “office_branch” in the name. This isn’t working however and I’m a bit stumped.

  • 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-16T22:07:20+00:00Added an answer on May 16, 2026 at 10:07 pm

    Since stripos will return the index (and it is a 0-based index returned) != 0 is incorrect.

    if (stripos($key,$text) !== false)
    

    Would be the correct way to check it. Give that a shot.

    EDIT

    Note the use of !== instead of != since 0 tends to be considered false if loosely checked the !== will check the actual type, so 0 is a valid return. Just an extra tidbit of information

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

Sidebar

Related Questions

I have a form that allows a user to update their profile information, but
I have a bound form in microsoft access that allows a user to add
I have a form that allows the user to add as many upload forms
I have a form that allows a user to add an unlimited number of
I have a php form that allows the user to add multiple copies of
I have a form I'm working with that allows the user to continually add
I have a form (will add form validation later) that allows the user to
I'm using ASP.Net/C# and I have a form that allows people to add information
I have a form that allows the user to add more form fields if
I have a form that allows the user to add or remove users from

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.