Jump to content

Archived

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

systech44

Session with Select & Check Option

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]

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites
Sorry sir this code unable to store the values in Session variables. Is there anything better.

Thank you in advance.

Share this post


Link to post
Share on other sites

×

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.