我正在尝试使用PHP将值从一页传递到另一页。 我有一个包含所有变量的会话文件,但是我无法传递其中一个,我也不知道为什么。 我也从foreach传递了一些值,因为该页面将其“更改”或“编辑”页面传递给游戏中的某些玩家。 我的第一页就是这个名字: https://imgur.com/a/GlpzVvF 此页面的代码是(我要传递到另一页面的部分是体内H2->上的变量“ nome”):
<!DOCTYPE html>
<?php
//Este ficheiro, APÓS LOGIN (autenticação) com sucesso; apresentará uma página de boas-vindas
include ('session.php');
?>
<html >
<head>
<title>DSE | Menu</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/style_welcome.css">
<link rel="shortcut icon" href="imagens/favicon.ico" />
<!-- CSS para a tabela com pesquisa funcionar -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="css/jquery.dataTables.min.css">
<link rel="stylesheet" href="css/buttons.dataTables.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="menu" tabindex="0">
<div class="smartphone-menu-trigger"></div>
<header class="avatar">
<img src="imagens/LOGO_DSE.png" />
<!-- Apresenta o nome do user após o login -->
<h2>Bem-vindo(a), <?php echo $nome;?>!</h2>
</header>
我希望它显示的页面是这个页面:https://imgur.com/a/C68lQpN 该页面的代码为:
<?php
include "functions.php";
$idutente=$_GET ['id'];
$nome=$nome;
$tasks = DBRead3($idutente);
foreach($tasks as $cl)
{
$cl_nome=$cl['nome'];
$cl_data_nascimento=$cl['data_nascimento'];
$cl_peso=$cl['peso'];
$cl_altura=$cl['altura'];
$cl_tipo_sangue=$cl['tipo_sangue'];
$cl_alergias=$cl['alergias'];
$cl_doencas=$cl['doencas'];
$cl_telefone=$cl['telefone'];
$cl_morada=$cl['morada'];
$cl_notas=$cl['notas'];
$cl_seguro=$cl['seguro'];
$cl_identificador=$cl['identificador'];
} ?>
<html >
<head>
<title>DSE | Menu</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/style_welcome.css">
<link rel="shortcut icon" href="imagens/favicon.ico" />
<!-- CSS para a tabela com pesquisa funcionar -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="css/jquery.dataTables.min.css">
<link rel="stylesheet" href="css/buttons.dataTables.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="menu" tabindex="0">
<div class="smartphone-menu-trigger"></div>
<header class="avatar">
<img src="imagens/LOGO_DSE.png" />
<!-- Apresenta o nome do user após o login -->
<h2>Bem-vindo(a), <?php echo $nome;?>!</h2>
</header>
我在页面顶部调用该值,然后在H2标签内的主体上再次使用它,但是它不起作用。 这里的foreach是调用我要编辑的变量... 有人知道如何帮助我吗?