Im currently filling a label with a session variable, however i need to use the label data later (send it to another label), or create a new session to do so. However, when i attempt to access the first label, or the session that ive set its tells me its not set. So im assuming the data in the first label is showing but its not actually there?
//this is how im creating the first label
<?php
include_once "dbcon.php";
//PERFORMING CHECK IF ALL REQUIRED SESSION VARIABLES ARE SET
if (isset($_SESSION['s_score1'], $_SESSION['s_score2'], $_SESSION['t_team1'], $_SESSION['t_team2'])) {
$team1 = $_SESSION['t_team1'];
$team2 = $_SESSION['t_team2'];
$score1 = $_SESSION['s_score1'];
$score2 = $_SESSION['s_score2'];
if ($score1 == $score2) {
header("Location: tables.php?table=draw"); //CHECKS IF MATCH IS A DRAW, CANNOT BE A DRAW
exit();
}else {
if ($score1 > $score2){
echo $_SESSION['t_team1'];
}else {
echo $_SESSION['t_team2'];
}
}
}else {
echo "-";
}
?>
//this is how im printing it
<label name="round2-team1" class="round2-teams">
<?php include_once "action/winner-script.php";?>
</label>
the issue appears when i try to use this label above, creating a session variable with it, or moving it to a new label is impossible, its like it doesnt exist, even though i can see it on the page???
<?php
include_once "dbcon.php";
//PERFORMING CHECK IF ALL REQUIRED SESSION VARIABLES ARE SET
if (isset($_SESSION['s_score9'], $_SESSION['s_score10'], $_SESSION['t_team9'], $_SESSION['t_team10'])) {
$team1 = $_SESSION['t_team9'];
$team2 = $_SESSION['t_team10'];
$score1 = $_SESSION['s_score9'];
$score2 = $_SESSION['s_score10'];
if ($score1 == $score2) {
header("Location: tables.php?table=draw"); //CHECKS IF MATCH IS A DRAW, CANNOT BE A DRAW
exit();
}else {
if ($score1 > $score2){
echo $_SESSION['t_team9'];
}else {
echo $_SESSION['t_team10'];
}
}
}else {
echo "-";
}
?>
This is the script, here i am taking my two labels that are displaying on the page, im determining the winner, and then im displaying the session variable which won the game in a different label on the same page. however, when i try using
<?php
if (isset($_SESSION['t_team9'])) {
echo $_SESSION['t_team9'];
}else {
echo "somethings wrong";
}
?>
anywhere on the page where my labels lie, i just get the error something went wrong
ATTEMPTED FIX:
<?php
include_once "dbcon.php";
//PERFORMING CHECK IF ALL REQUIRED SESSION VARIABLES ARE SET
if (isset($_SESSION['s_score13'], $_SESSION['s_score14'], $_SESSION['result'], $_SESSION['result2'])) {
$team1 = $_SESSION['result'];
$team2 = $_SESSION['result2'];
$score1 = $_SESSION['s_score13'];
$score2 = $_SESSION['s_score14'];
if ($score1 == $score2) {
header("Location: tables.php?table=draw"); //CHECKS IF MATCH IS A DRAW, CANNOT BE A DRAW
exit();
}else {
if ($score1 > $score2){
$team1 = $_SESSION['result'];
$_SESSION['result5'] = $team1;
}else {
$team2 = $_SESSION['result2'];
$_SESSION['result5'] = $team2;
}
}
}else {
echo "-";
}
?>