在新页面上显示php结果


Displaying php results on a new page

我已经看到了一些例子,我知道如何解决它,但是我使用的复选框上的名称使用了连接。因此,我不知道如何在使用名称的新页面上发布数据。我试了好几种方法,到目前为止都没有结果。我需要在saveggames .php上发布的数据,然后我要使用一个函数来解析数据,并选择那些只有$id和checked(示例:"43checked")

UpcomingGames.php

<form name="saveGames" action="saveGames.php" method="post"> 
//Code
</form>

/*PHP function for setting up checkboxes for many different rows. I set up the name as $id which is the gameId and I added checkbox next to it so later I can parse through the data and select the ones with checked as the value because those games were selected. */
function checkbox($params)
{
  echo "<td>";
  $id = $params["gameID"];
  echo "<input id='"$id'" type='"checkbox'" name='". $id ."checkbox'>";
  echo "</td>";
}

尝试在此页上发表文章saveGames.php

<?php include('header.php'); ?>

<?php
  require_once('dbBaseDao.php');
  require_once('dbUserDao.php');
  require_once('dbBotDao.php');
  $userDao = new dbUserDao();
  $botDao = new dbBotDao();
 $ChosenGame = $_POST["'. $id 'checked"];
 echo $ChosenGame;
?>

您真的需要在输入标签的name部分使用word复选框吗?如果没有,问题解决。

如果你想要它,那么你必须找到一个方法来传递存储在变量$id中的值到下一页。你可以使用一个隐藏的输入标签。