My Multi-form Pages Works Great Until I Unset A Variable. Why?
I have been working on a multi-form page for a while. I need some help trying to understand why when I unset my variable that the multi-form pages ceases to work correctly. I place
Solution 1:
Values stored in the session must be discarded at the end of the script execution.
- Destroy
$_SESSION
usingunset($ _ SESSION)
and- then destroy the session itself using
session_destroy();
Solution 2:
I was able to clear the variable by using a windows popup once an if statement was fullfilled.
if ($Num_CTeams > 1 && $_SESSION["Pickleball"] !="") {
echo'<script language="javascript">';
echo'alert("Sorry, Captains can only captain up to two teams ONLY.")';
echo'</script>';
$_SESSION["formatPickleball"] = "";
}
Solution 3:
<?php
session_start();
echo$_SESSION["formatPickleball"];
$_SESSION["Pickleball"] = "";
if (isset($_POST['format1']) && $_POST['format1'] && isset($_POST['member']) && $_POST['member']) {
$_SESSION["formatPickleball"] = $_POST['member'];
$_SESSION["Pickleball"] = "hide";
}
if ($_SESSION["formatPickleball"] == "Captain") {
$regCAP = isset($_POST['submitCAP']) && $_POST['submitCAP'] ? "show": "";
$secondCAP = isset($_POST['submit2']) && $_POST['submit2'] ? "show": "";
$thirdCAP = isset($_POST['submit3']) && $_POST['submit3'] ? "show": "";
}
if ($_SESSION["formatPickleball"] == "Player") {
$regPlay = isset($_POST['submitPlay']) && $_POST['submitPlay'] ? "show" : "";
}
Post a Comment for "My Multi-form Pages Works Great Until I Unset A Variable. Why?"