Solved

PHP Parse Array

Posted on 2006-06-29
2
330 Views
Last Modified: 2008-03-10
Hi Experts,

pg1.php sent a form to pg2.php as $_POST['return'], pg2.php extracted the array data within $_POST['return'] and used the data.

Now I need to send that same array to pg3.php and extract the data from the array.

The array contains nothing but a list of id numbers.

Data must be parsed when they click a Send Email Link.

Please Help!

Thanks in advance
0
Comment
Question by:etechnicsit
  • 2
2 Comments
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 250 total points
ID: 17016004
Add it to a session in pg2.php which can be read in pg3.php

<?php // pg2.php
session_start();
$_SESSION['Previous_POST'] = $_POST;

// continue with ph2.php
?>

<?php // pg3.php
session_start();

// NOTE: This will overwrite any $_POST supplied.
$_POST = $_SESSION['Previous_POST'];

// Alternatively, leave $_POST alone and just use $_SESSION['Previous_POST'] as an array.

// Continue with pg3.php
?>
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 17016013
If pg2.php contains a form which also uses POST, then you could ...

<?php
$s_POST = serialize($_POST);

$s_hidden_post = '<input type="hidden" name="Previous_POST" value="' . $s_POST . '">';

// Now use $s_hidden_post in the form somewhere.

echo <<< END_HTML
<form method="POST" action="./pg3.php">
$s_hidden_post
<input type="text" name="something">
<input type="submit">
</form>
END_HTML;
?>
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question