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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:22:12+00:00 2026-05-14T01:22:12+00:00

Language: PHP I have a form which asks users for their educational details, course

  • 0

Language: PHP

I have a form which asks users for their educational details, course details and technical details. When the form is submitted the page goes to a different page to run processes on the information and save parts to a database. HOWEVER(!) I then need to return the page back to the original page, where having access to the original post information is needed.

I thought it would be simple to copy (by value) the multi-dimensional (md) $_POST array to $_SESSION[‘post’]

session_start(); 
$_SESSION['post'] = $_POST;

However this only appears to place the top level of the array into $_SESSION[‘post’] not doing anything with the children/sub-arrays.

An abbreviated form of the md $_POST array is as follows:

Array
(
    [formid] => 2
    [edu] => Array
        (
            ['id'] => Array
                (
                    [1] => new_1
                    [2] => new_2
                )

            ['nameOfInstitution'] => Array
                (
                    [1] => 1
                    [2] => 2
                )

            ['qualification'] => Array
                (
                    [1] => blah 
                    [2] => blah
                )

            ['grade'] => Array
                (
                    [1] => blah
                    [2] => blah 
                )

        )

    [vID] => 61
    [Submit] => Save and Continue
)

If I echo $_SESSION[‘post’][‘formid’] it writes “2”, and if I echo $_SESSION[‘post’][‘edu’] it returns “Array”. If I check that edu is an array (is_array($_SESSION[‘post’][‘edu])) it returns true. If I echo $_SESSION[‘post’][‘edu’][‘id’] it returns array, but when checked (is_array($_SESSION[‘post’][‘edu][‘id’])) it returns false and I cannot echo out any of the elements.

How do I successfully copy (by value, not by reference) the whole array (including its children) to an new array?

THANKS EVERYONE FOR RESPONDING – UPDATE
The issue was caused my irrelevant quote marks in the naming of fields in my form.

  • 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-14T01:22:12+00:00Added an answer on May 14, 2026 at 1:22 am

    if this is your real print_r output, then you have some unwanted chars in your array keys.

    Array
    (
        [formid] => 2
        [edu] => Array //<--- $_SESSION['post']['edu']
            (
                ['id'] => Array // <---- $_SESSION['post']['edu']["'id'"]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 412k
  • Answers 412k
  • 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 You could use the Graphics.MeasureString() method. With a code sample… May 15, 2026 at 8:10 am
  • Editorial Team
    Editorial Team added an answer It's not possible in the way you described. The closest… May 15, 2026 at 8:10 am
  • Editorial Team
    Editorial Team added an answer What good would getting the repository be if you don't… May 15, 2026 at 8:10 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

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.