Jump to content

Session with Select & Check Option


systech44

Recommended Posts

I want to know how to retrieve values from Se;ect option and Check Box option and stored them in Session variables. I am trying with the folllowing snippet of code. But this is not working. please help.

Thank you in advance.


[code=php:0]
<?php

// Session1.php

if(isset($_POST["spreads"], $_POST["major"], $_POST["minor"]))
{
      session_start();
      $_SESSION["spreads"]=$_POST["spreads"];
      $_SESSION["major"]=$_POST["major"];
      $_SESSION["minor"]=$_POST["minor"];
}

?>
[/code]



[code=php:0]
<?php

// Session2.php

session_start();
$spreads="";
$major="";
$minor="";

if(!empty($_SESSION["spreads"]))
{
      $spreads=$_SESSION["spreads"];
      $major=$_SESSION["major"];
      $minor=$_SESSION["minor"];
}

echo "Spreads: ".$spreads."<br>";
echo "Major: ".$major."<br>";
echo "Minor: ".$minor."<br>";

session_destroy();

?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/20103-session-with-select-check-option/
Share on other sites

[code]
<?php session_start();

// Session1.php

if( isset($_POST["spreads"])&& ($_POST["major"])&& ($_POST["minor"]) )
{
      $_SESSION["spreads"]=$_POST["spreads"];
      $_SESSION["major"]=$_POST["major"];
      $_SESSION["minor"]=$_POST["minor"];
}

?>
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.