Setting data to $_POST without using a form. Is it possible?
Posted: Tue Mar 01, 2005 12:50 pm
Hi
I was wondering whether it's possible to set data into the POST array to be transferred between pages, without using a form?
I've just tried this on a blank test page...
And it appears that you can set the POST array within the page, and access the data.
Obviously you may as well just call your array something else to do this.
Then on the next page test4.php...
Obviously doesn't return the data that I set on the previous page.
What I'd like to know is if there's a way to set the post data on one page, then access it on a subsequent page.
I guess it's down to how you switch to the next page - i'd like to be able to do this by just the user just clicking a link.
Just wondered if it is possible.
As I want to have data passed between pages, but I don't want to use the address bar $_GET data. And there will be quite a few variables I'll need to pass between pages, each with a large amount of data.
If it isn't possible then no problem - I'll just use sessions.
Is it possible though?
Thanks
Batfastad
I was wondering whether it's possible to set data into the POST array to be transferred between pages, without using a form?
I've just tried this on a blank test page...
Code: Select all
<?php
$_POST = array();
$_POSTї"test"] = "test data";
?>
<a href="test4.php">go</a><br />
<br />
<?php
echo($_POSTї"test"]);
?>Obviously you may as well just call your array something else to do this.
Then on the next page test4.php...
Code: Select all
<?php
print_r($_POST);
?>What I'd like to know is if there's a way to set the post data on one page, then access it on a subsequent page.
I guess it's down to how you switch to the next page - i'd like to be able to do this by just the user just clicking a link.
Just wondered if it is possible.
As I want to have data passed between pages, but I don't want to use the address bar $_GET data. And there will be quite a few variables I'll need to pass between pages, each with a large amount of data.
If it isn't possible then no problem - I'll just use sessions.
Is it possible though?
Thanks
Batfastad