I'm trying to pass a value from a select input control on an HTML form.
Here is the PHP of page1.php:
session_start();
$_SESSION['invtype'] = $invtype;
header("location: offerform_switch.php");
Here is the HTML:
<select id="invtype" name="invtype">
<option value="0" selected="selected">Select type</option>
<option value="product">PRODUCT</option>
<option value="software">SOFTWARE</option>
</select>
This is offerform_switch.php:
session_start();
echo $_SESSION['invtype'];
switch ($invtype){
case "product":
include("page2_product.php");
break;
case "software":
include("page2_software.php");
break;
default:
echo "The invention type did not go through correctly.";
}
I get this:
The invention type did not go through correctly.
all the time.
Although, if I hardcode the SESSION variable value in page1.php, like this:
$_SESSION['invtype'] = 'product';
I get this:
productThe invention type did not go through correctly.
all the time.
which means that the value does pass from one page to the other, right?
Can't figure out what I'm doing wrong.