This question already has an answer here:
Im using wordpress
I wanted to send the data that is collected by form in the first page to the next page
I didn't find anything that can send array data to another page other than GET command, GET commands uses URL, The reason I'm not using this GET is the sending information includes price values that are calculated using entered information
I found this $_session seems ok to my case (If any others are available, please tell me), Used wp session manager plugin to use $_SESSION.
im using it like this,
if(!isset($_SESSION)){
session_start();}
if(isset($_GET['B2'])) {
$_SESSION["info"] = "user-form";
$_SESSION["weight"] = $weight;
$_SESSION["price"] = $weight;
buy_now(); }
The B2 is a buy now button
function buy_now(){
if(isset($_GET['B2'])) {
header("Location:".get_site_url()."/buy-now/");
}
if(!isset($_SESSION)){
session_start();}
echo $_SESSION["info"]."<br>";
echo $_SESSION["weight"]."<br>";
echo $_SESSION["price"]."<br>";
}
The weight and price are Undefined index, the info will display.
What is the problem here? and How can I send variables to another page?, I'm unable to find any solution for now. Please help with this...
Thank you
</div>