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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:39:57+00:00 2026-05-23T18:39:57+00:00

Right, when users submit a form to update their contact information… odd things happen

  • 0

Right, when users submit a form to update their contact information… odd things happen that make very little sense to me, and make it impossible for me to properly parse the resulting data.

The $_POST data sent to my script (found via print_r) is as follows:

Array
(
    [name_first] => Charles
    [name_last] => Broughton
    [company] => 
    [address1] => 
    [address2] => 
    [city] => Bristol
    [region] => England
    [postal] => 
    [country] => 1
    [email] => *******************
    [phones_types] => Array
        (
            [0] => Cell
        )

    [phones_numbers] => Array
        (
            [0] => ************
        )

    [phone_types] => Array
        (
            [1] => Home
        )

    [phone_numbers] => Array
        (
            [1] => ************
        )

    [pass] => **********
    [id] => 
)

The form creating this odd output is as follows:

<form action="URL" method="POST">
  <table class="data" align="center" border="0" cellpadding="10" cellspacing="0" width="100%"><tbody>
    <tr>
      <th colspan="3">Edit Contact</th>
    </tr>
    <tr>
      <td>First Name:</td>
      <td><input type="text" name="name_first" value="Charles"/> (required)</td>
    </tr>
    <tr>
      <td>Last Name:</td>
      <td><input type="text" name="name_last" value="Broughton"/></td>
    </tr>
    <tr>
      <td>Company:</td>
      <td><input type="text" name="company" value=""/></td>
    </tr>
    <tr>
      <td>Address Line 1:</td>
      <td><input type="text" name="address1" value=""/></td>
    </tr>
    <tr>
      <td>Address Line 2:</td>
      <td><input type="text" name="address2" value=""/></td>
    </tr>
    <tr>
      <td>City:</td>
      <td><input type="text" name="city" value="Bristol"/> (required)</td>
    </tr>
    <tr>
      <td>Region:</td>
      <td><input type="text" name="region" value="England"/> (required)</td>
    </tr>
    <tr>
      <td>Postal:</td>
      <td><input type="text" name="postal" value=""/></td>
    </tr>
    <tr>
      <td>Country:</td>
      <td><select name="country">
        <option value="1" selected="selected">United Kingdom</option>
        <option value="2">United States</option>
      </select> (required)</td>
    </tr>
    <tr>
      <td>Email:</td>
      <td><input type="text" name="email" value="*******************"/> (required)</td>
    </tr>
    <tr>
      <td>Phones(s):</td>
      <td><input type="text" name="phones_types[0]" value="Cell"/>: <input type="text" name="phones_numbers[0]" value="************"/><br/><input type="text" name="phone_types[1]"/>: <input type="text" name="phone_numbers[1]"/></td>
    </tr>
    <tr>
      <td>Current Password:</td>
      <td><input type="password" name="pass"/> (required)</td>
    </tr>
    <tr align="center">
      <td colspan="2"><input type="submit" value="Save Changed"/></td>
    </tr>
    <input type="hidden" name="id" value=""/>
  </tbody></table>
</form>

Does anybody know how I can remedy this, or parse it properly using PHP? I tried a for loop to parse both arrays as one, but neither of them are arrays due to the separation… the example of which is in the above print_r output.

—

EDIT I was attempting to parse the form data using the following bit of PHP, with the proceeding error message being outputted.

if (count($_POST['phone_types'])!=0 && count($_POST['phone_numbers'])!=0)
{
  for ($i = 0; $i < count($_POST['phone_types']); $i++)
  {
    if (!empty($_POST['phone_types'][$i]) && !empty($_POST['phone_numbers'][$i]))
      $phones[$_POST['phone_types'][$i]] = $_POST['phone_numbers'][$i];
  }
  $ph = "";
  foreach ($phones as $k => $v)
  {
    $ph.= "$k:$v;";
  }
  $phones = $ph;
}
else
  $phones = "";

Error:

Warning: Invalid argument supplied for `foreach()` in `FILE` on line 35
  • 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-23T18:39:58+00:00Added an answer on May 23, 2026 at 6:39 pm
    <input type="text" name="phones_types[0]" value="Cell"/>: 
    <input type="text" name="phones_numbers[0]" value="************"/><br/>
    <input type="text" name="phone_types[1]"/>: 
    <input type="text" name="phone_numbers[1]"/>
    

    should be:

    <input type="text" name="phones_types[0]" value="Cell"/>: 
    <input type="text" name="phones_numbers[0]" value="************"/><br/>
    <input type="text" name="phones_types[1]"/>: 
    <input type="text" name="phones_numbers[1]"/>    
    

    in order to be able to loop the phones_types & phones_number using a foreach

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

Sidebar

Related Questions

Right now, when I submit a form, I get this in my URL: http://www.taiwantalk.org/users/admin/edit/?updated=true
I have a form which users can add controls to and when they right
Normally my form prevented users to submit it when it was under 4 characters.
I have a page that allows users to comment on answers very similar to
I have a nested multimodel form right now, using Users and Profiles. Users has_one
Right now, users click a button with JQuery. It dynamically adds a new form
I have a form submit button that I need to enable the user to
Apparantly when users right-click in our WPF application, and they use the Windows Classic
Right now we have AD/Exchange to manage all of our users logins/e-mail on-site at
We have a script right now which our Windows users run on a Linux

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.