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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:03:17+00:00 2026-05-23T11:03:17+00:00

Hello I have POST array that looks like this, Array ( [email_address] => Array

  • 0

Hello I have POST array that looks like this,

Array (
  [email_address] => Array ( 
    [0] => simon@simonainley.info  
    [1] => simon2@simonainley.info 
  ) 
  [firstname] => Array ( 
    [0] => Simon 
    [1] => Simon2 
  ) 
  [surname] => Array ( 
    [0] => Ainley 
    [1] => Ainley2 
  ) 
  [companies_company_id] => NULL,
  [save_user] => Save User 
)

I wanting to create an new array where I would get the first email_address, firstname, and surname into an array, deal with that data and then proceed to the next email-address, firstname and surname.

Is this possible? I have tried this code,

$newArray = array();
    foreach($_POST as $key => $value)  {
    $newArray[] = $value;
}

however that code just produces this,

Array (
  [0] => Array ( 
      [0] => simon@simonainley.info 
      [1] => simon2@simonainley.info
  )
  [1] => Array ( 
      [0] => Simon 
      [1] => Simon2
  ) [2] => Array ( [0] => Ainley [1] => Ainley2 ) [3] => [4] => Save User ) 1

What do I need to do?

  • 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-23T11:03:18+00:00Added an answer on May 23, 2026 at 11:03 am
    $count = count($_POST['firstname']);
    $result = array();
    for ($i = 0; $i <= $count; $i ++) {
      $result[] = array(
        'email_address' => $_POST['email_address'][0],
        'firstname' => $_POST['firstname'][0],
        'lastname' => $_POST['lastname'][0]
      );
    }
    

    or (if the numeric indices have any meaning)

    $result = array();
    foreach (array_keys($_POST['email_address']) as $index) {
      $result[$index] = array(
        'email_address' => $_POST['email_address'][$index],
        'firstname' => $_POST['firstname'][$index],
        'lastname' => $_POST['lastname'][$index]
      );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I have an array that looks like this after passing it through uksort()
hello i have a form like this <form id=ricerca enctype=application/x-www-form-urlencoded method=post action=><table class=inserisci_modifica> <tr
I have the following data: A post called Hello has categories greet Another post
Hello I have been having trouble with this for a while now. I have
Hello i have this form filling javascript: function onLine(code,nn) { document.writeform.bericht.value+=code; document.writeform.bericht.focus(); document.writeform.nickname.value+=nn; write1();
Hello i have somme problems to write a simple XML-RPC client in PHP. This
I have to sort this array in descening order with the key likecount. How
Say I have a post called Hello World in Wordpress and I'm directly viewing
Hello I have a jQuery function that will send to a php file some
Firstly Hello, This is my first post on this forum. I am completing a

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.