Solved

PHP Parse Array

Posted on 2006-06-29
2
313 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:
RQuadling 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:RQuadling
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

948 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now