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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:59:42+00:00 2026-06-11T17:59:42+00:00

Here is my code, //I have set formData array to session array here $_SESSION[‘form_data’]

  • 0

Here is my code,

//I have set formData array to session array here
$_SESSION['form_data'] = $formData = array();           

//here i have set a value to formData array
$formData[0] = 'insert data done';

//I want to accually echo the value of formData[0] - key's value        
$var = $_SESSION['form_data'][$formData[0]];

var_dump($var);

I’m new to php and my requirement here is to build a form validation and send the validation data back to the form. So I use the session to send data to one php file to another. I think that’s the only way I can send data from one page to another.

  • 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-11T17:59:43+00:00Added an answer on June 11, 2026 at 5:59 pm
    // the code only initialize $_SESSION['form_data'] and $formData with an empty array
    // after assignment, they're independent.
    $_SESSION['form_data'] = $formData = array(); 
    // change the $formData won't affect the $_SESSION['form_data']
    $formData[0] = 'insert data done';
    

    The right order is:

    $formData = array();
    $formData[0] = 'insert data done';
    $_SESSION['form_data'] = $formData;
    
    $var = $_SESSION['form_data'][0];
    var_dump($var);
    

    But for form validation, you don’t need to redirect to the input page if validation failed.
    Instead, just use the same template (html content), and render the page with error message, this way, you don’t need to send data back to the input page.

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

Sidebar

Related Questions

I have a card layout set in my app.js. here's the code; ... launch:
Here is the problem from code chef : A set of N dignitaries have
Here is the code I have written for Rectangle class. class Rectangle (l: Double,
enter code here I have a table on SQL server 2005 with bigint primary
Here is the code I have to create an UIAlertView with a textbox. UIAlertView
Here's the code I have: var commandsBuffer = List[String]() commandsBuffer ::= cmd.exe commandsBuffer ::=
Here's the code I have: from cStringIO import StringIO from lxml import etree xml
enter code here I have a ListView that have a different Layout XML for
Here is the code I have tried to append a node in existing xml,
I have some code here that uses bitsets to store many 1 bit values

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.