douyi1963 2019-04-11 15:33 采纳率: 0%
浏览 34

如何在没有POST的情况下将值从页面传递到其他页面

Im trying to pass a value from one page to another by using PHP. I have a session file that have the all variables but i can´t pass one of them and I don´t know why. I´m passing some values from a foreach too because the page its a "change" or an "edit" page to some players from a game. My first page where I have the name is this one: https://imgur.com/a/GlpzVvF The code of this page is (the part that I want to pass to the other page is the variable "nome" on the H2 -> inside the body):

<!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>

The page that I want it to appear is this one: https://imgur.com/a/C68lQpN The code of the page is:

<?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>

I´m calling the value on the top of the page, and using it again on the body inside the H2 tag, but it´s not working. The foreach here is to call the variables that i want to be edited... Does anyone know how to help me?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 luckysheet
    • ¥25 关于##爬虫##的问题,如何解决?:
    • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
    • ¥15 找一位技术过硬的游戏pj程序员
    • ¥15 matlab生成电测深三层曲线模型代码
    • ¥50 随机森林与房贷信用风险模型
    • ¥50 buildozer打包kivy app失败
    • ¥30 在vs2022里运行python代码
    • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
    • ¥15 求解 yolo算法问题