如何在不显示空白的情况下呼叫设置的会话

时间:2019-03-30 13:39:29

标签: php html session isset

我用一个会话填充选择框,然后我尝试调用此选择框以用相同的结果填充另一个。但是其返回的空白。 我知道会话正在设置,因为我可以在所需的选择框中看到它,但是我不能再次调用它并将它传递给另一个,而不会返回空白。

//我的html,其中包括外部php。

  <form class="seed-form" method="POST" action="action/matchup1-action.php">
    <label name="round2-team1" class="round2-teams">
      <?php include_once "action/winner-script5.php";?>
    </label>

//被调用的matchup 1脚本。

if (isset($_POST['go5'])) { // MATCHUP 5 SECOND ROUND MATCHUP 1

  include_once 'dbcon.php';

  $_SESSION['t_team9'] = $_POST['team-9'];
  $_SESSION['t_team10'] = $_POST['team-10'];
  $_SESSION['s_score9'] = $_POST['score-9'];
  $_SESSION['s_score10'] = $_POST['score-10'];
  header("Location: ../tables.php?tables=winner5");
}

//正在从其当前选择框中调用会话的脚本

<?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 "-";
}
?>

///我要在其中输出会话变量

<label name="round2-team1" class="round2-teams">
          <?php include_once "action/winner-script5.php";?>
        </label>

0 个答案:

没有答案