php session form data retreival
Posted: Mon Jun 29, 2009 6:43 pm
Hello everyone, thanks for any help you could provide I am spinnin' my wheels.
I am trying to use the SESSION var. to hold the contants of a form variable over other php pages. It seems no matter what I do I cannot display the form var. on a second php page or retrieve it on the initial page when I use the back button.
test-display.php
and test-pump.php
You can find the page here:
http://www.lightmypump.com/pumpdatabase ... isplay.php
Cheers,
Jacques
I am trying to use the SESSION var. to hold the contants of a form variable over other php pages. It seems no matter what I do I cannot display the form var. on a second php page or retrieve it on the initial page when I use the back button.
test-display.php
Code: Select all
<?php
//This call leither opens a new session or finds an existing onw
session_start();
require 'header.html';
echo "<FORM NAME =\"form2\" METHOD =\"GET\" ACTION =\"test-pump.php\">";
echo "<INPUT TYPE = \"Submit\" Name = \"Submit1\" VALUE = \"Modify display\">";
echo "Choose flow unit: ";
echo "<select name=\"flow_metric\">";
echo "<option value=\"USgpm\">USgpm</option>";
if ($flow_metric == "l/s") echo "<option SELECTED value=\"l/s\">l/s</option>";
else echo "<option value=\"l/s\">l/s</option>";
if ($flow_metric == "l/min") echo "<option SELECTED value=\"l/min\">l/min</option>";
else echo "<option value=\"l/min\">l/min</option>";
if ($flow_metric == "m3/h") echo "<option SELECTED value=\"m3/h\">m3/h</option>";
else echo "<option value=\"m3/h\">m3/h</option>";
echo "</select>";
$flow_metric = $_GET['flow_metric'];
$_SESSION['flow_metric'] = $flow_metric;
$_SESSION['color']='red';
echo "</FORM>";
echo "Metric flow value is ".$_SESSION['flow_metric'];
// standard html web page footer
require 'footer.html';
?>Code: Select all
<?php
//This call leither opens a new session or finds an existing onw
session_start();
// standard html web header
require 'header.html';
echo "Metric flow value is ".$_SESSION['flow_metric'];
echo "Our color value is ".$_SESSION['color'];
// standard html web page footer
require 'footer.html';
?>
You can find the page here:
http://www.lightmypump.com/pumpdatabase ... isplay.php
Cheers,
Jacques