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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.