James Stafford
James Stafford

Reputation: 1054

forward post or get string

I am building a php script which requires me to forward the post or get string that was sent to this script to the next one. I was trying to figure out how I can forward this information to the next page - obviously I put

<form action="script.php?(previous get string)>

but the real question is - how do I retrieve the entire string - or is it not possible.

Thanks

Upvotes: 1

Views: 65

Answers (1)

raidenace
raidenace

Reputation: 12834

If it can be both post of get, then you can save it into a session variable and get it in the next page like so:

page1.php

<?php
session_start();
$_SESSION['post'] = $_POST;
$_SESSION['get'] = $_GET;
?>

page2.php

<?php
session_start();
$previous_post = $_SESSION['post'];
$previous_get = $_SESSION['get'];
?>

Upvotes: 2

Related Questions