I have a page with a form that needs to be sent via post. My htaccess has redirects in it causing the post data to be lost so I would like to put that data into session variables to be picked up by another page.
The session variable "favcolor" below on the form page is there just as a tester. The output on the second page should show the data from the form but it is not. It's an empty array. It is showing the color variable ok though.
I've cut the code right back here to the simplest few lines to test this out and can't get it to work. Can anyone help point me in the right direction here please?
Form page:
<?php
session_start();
$_SESSION['post-data'] = $_POST;
?>
<form action="zv.php" method="post">
Name:<br>
<input type="text" id="inputName" name="inputName">
<br>
Email:<br>
<input type="text" id="inputEmail" name="inputEmail">
<br>
Telephone Number:<br>
<input type="text" id="inputTel" name="inputTel">
<input type="submit" id="submit" value="Submit">
</form>
<?php
$_SESSION["favcolor"] = "green";
?>
Second page (zv.php):
<?php
session_start();
print_r($_SESSION['post-data']);
echo "<br>";
print_r($_SESSION);
?>
Output from second page (zv.php):
Array ( )
Array ( [post_data] => Array ( ) [post-data] => Array ( ) [favcolor] => green )