数组变量链接到另一个页面

时间:2017-01-02 08:27:59

标签: php html arrays

目前我被困住了。我必须得到域名的概述。这些必须链接到记录页面。问题是,我不知道如何。我试图设置一个$ _SESSION,但然后它选择了我的数组的第一个变量。目前用1个例子硬编码。

<?php

unset($command);
$command = array(
"command" => "DomainsListActive"
);

$api = new Versio_api();
$versio = $api->api_send($command);

if($versio['success']==0) {
echo("Fout opgetreden. Fout code: ".$versio['command_response_code'].". Fout text: ".$versio['command_response_message']."");
}
else {
if($versio['total_count']>0)
{
require_once("includes/submenu.php");
?>
<div class="col-sm-9 col-md-9" style="width:80%;">
  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">Klantenpaneel</h3>
    </div>
    <div class="panel-body">
      <form method="post" action="">
        <table class="table table-striped">
          <thead>
            <tr>
              <th>Domein</th>
              <th>TLD</th>
              <th>Verloop datum</th>
              <th>Automatisch verlengen</th>
            </tr>
          </thead>
          <table class="table table-striped table-bordered">
            <tbody>
              <?php 
$teller = 1;
while($versio['total_count']>=$teller) {
?>
              <tr>
                <td><?php echo $versio['id_'.$teller]; ?></td> 
                <td><a href="records.php"><?php echo $versio['domain_'.$teller]; ?></a> </td>
                <td><?php echo $versio['tld_'.$teller]; ?></td> 
                <td><?php echo $versio['expiration_date_'.$teller]; ?></td>
                <td><?php echo $versio['auto_renew_'.$teller]; ?></td>
              </tr>
<?php $teller++; } ?> 
            </tbody>
          </table>
          </form>
        </div>
    </div>
<?php
  } else {
    echo("Er zijn geen DNS records gevonden voor dit domein.");
  }
}
?>

我必须得到例如$ versio [&#39; domain _&#39;。$ teller]的第三个变量,将我的数组放入antoher文档record.php中。如果有人可以帮助我那会很棒!

1 个答案:

答案 0 :(得分:0)

如果我理解正确,你能否在查询字符串中传递变量?

例如:

<a href="records.php?domain=<?php echo $versio['domain_'.$teller]; ?>&tld=<?php echo $versio['tld_'.$teller]; ?>">
    <?php echo $versio['domain_'.$teller]; ?>
</a>

然后在records.php中,您可以使用以下内容获取这些值:

<?php

$domain = $_GET['domain'];
$tld = $_GET['tld'];