【问题标题】:Why it failed to pass the value?为什么它未能传递价值?
【发布时间】:2015-09-30 14:56:29
【问题描述】:

我有一个名为 MemberArea.php 的页面,它使用引导选项卡根据 div id 更改其内容。

<div id="tabs-1" class="tab-pane fade in active">
    <div class="tabbable tabs-left">
    <br />
        <ul class="nav nav-tabs" id="maincontent" role="tablist">
            <li class="active"><a data-toggle="tab" href="#tabs-5" role="tab">Basic Information</a></li>
            <li><a data-toggle="tab" href="#tabs-6" role="tab">View Team</a></li>
        </ul>
    <div class="tab-content">
        <div id="tabs-5" class="tab-pane active">
            <?php include("information.php"); ?>
        </div>
    <div id="tabs-6" class="tab-pane">
        <?php include("viewTeam.php"); ?>
    </div>
    <div id="tabs-14" class="tab-pane">
        <?php include("EditSinging.php"); ?>
    </div>
    <div id="tabs-15" class="tab-pane">
        <?php include("EditSpeech.php"); ?>
    </div>
    <div id="tabs-16" class="tab-pane">
        <?php include("EditStory.php"); ?>
    </div>
    </div>
</div>

在ViewTeam中,显示所有已注册的团队

<?php 
$query="select * from etj12singing where etj12id=$id  AND etj12Pay ='Yes' ";
$result =mysql_query($query);
while($row= mysql_fetch_array($result))
{
    $SIidnumber=$row['etj12idnum'];
    $SIidtype = $row['etj12idtype'];
    $SIfullName =  $row['etj12fullname'];
    $SIgender = $row['etj12gender'];
    $SIemail = $row['etj12email'];
    $SIphone = $row['etj12phone']; 
    $SIvege = $row['etj12vege'];
    $SIpay = $row['etj12Pay'];
    $SIidsinging = $row['etj12idsinging'];
?>
<tr>
    <td><?php echo $SIidnumber; ?></td>
    <td><?php echo $SIidtype; ?></td>
    <td><?php echo $SIfullName; ?></td>
    <td><?php echo $SIgender; ?></td>
    <td><?php echo $SIemail; ?></td>
    <td><?php echo $SIphone; ?></td>
    <td><?php echo $SIvege; ?></td>
    <td><?php echo $SIpay; ?></td>
    <td>
        <a data-toggle="tab" href="?idSIE=<?php echo $SIidsinging; ?>#tabs-14" role="tab">
        <input type="submit" value="Edit" class="btn-warning"/>
    </td>
</tr>

我的问题是我无法将值传递给 tabs-14(EditSinging.php)

这是我在 tabs-14(EditSinging.php) 中获取值的方法

$idsinging=$_GET['idSIE'];

更新
这是 EditSinging.php 中的代码 php:

$idinst = $_SESSION['id'];
$idsinging=$_POST['idSIE'];

$query = "SELECT * FROM etj12singing WHERE etj12id=$idinst AND etj12idsinging=$idsinging";
$result = mysql_query($query);
if($row=mysql_fetch_array($result))
{
    $idNum = $row['etj12idnum'];
    $idtype = $row['etj12idtype'];
    $fullname = $row['etj12fullname'];
    $gender = $row['etj12gender'];
    $email = $row['etj12email'];
    $phone = $row['etj12phone'];
    $vege = $row['etj12vege'];
}

下面是编辑我从上面的查询中得到的值的表单

<table style="width:100%;height:auto;border-spacing:10px;border-collapse:separate"> 
<tr>
    <td>Id Number<br/>
   <span style="font-style:italic;">(Nomor Identitas)</span> 
   </td>
    <td>
        <input type="text" id="IdNumber" name="IdNumber" value="<?php echo $idNum; ?>" class="textbox_register"/>
        <input type="hidden" name="idSIC" value="<?php echo $idsinging; ?>" class="textbox_register"/>
        <br/><label id="err1" class="error"></label>
    </td>
</tr></table>

【问题讨论】:

  • 您在 URL 中看到idSIE=&lt;whatever&gt; 吗?你能显示 EditSinging.php 的代码吗,因为这是你认为你有问题的那个?
  • @JonStirling 不,我没有看到。它移动到 EditSinging.php 但它的 url 仍然是 MemberArea.php 它根本没有改变。好的,我会发布它
  • 那是你的问题。如果它不在 URL 中,那么它不在 $GET 中。链接错误,或者您无权访问该 ID。
  • 你知道怎么解决吗?挣扎了几天
  • 您需要使用任何链接将其添加到链接中。您在 ViewTeam 视图中有它,那么您是否有从其他地方指向相关页面的链接?如果没有,当您将鼠标悬停在链接上时,ID 是否在其中?

标签: php twitter-bootstrap bootstrap-tabs


【解决方案1】:

在您的 ViewTeam 文件中查询:

$query="select * from etj12singing where etj12id=$id  AND etj12Pay ='Yes' ";

此内容 ($id) 未在文件中定义; 你必须给字符串(id)一个值。 所以你的查询返回空结果。

我认为这是你遇到的问题。

【讨论】:

  • 对不起。看来你不明白我的问题。我的查询没有任何问题
  • @Ali 基于 OP 详细信息,该部分工作得非常好。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-05-14
  • 2022-01-11
  • 2016-09-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多