Solved

PHP Parse Array

Posted on 2006-06-29
2
334 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

733 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