我有一个结帐页面,其中列出了用户的地址。它采用以下格式:
<form action="confirm.php" method="post" name="checkout">
<?php do { ?>
<div class="panel panel-default" style="padding:0">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse<?php echo $row_Address['ID'] ?>">
<?php echo $row_Address['FirstName'] ?> <?php echo $row_Address['LastName'] ?>, <?php echo $row_Address['City'] ?> <?php echo $row_Address['Pincode'] ?></a>
</h4>
</div>
<div id="collapse<?php echo $row_Address['ID'] ?>" class="panel-collapse collapse">
<div class="panel-body">
<p>
<?php echo $row_Address['FirstName']; ?> <?php echo $row_Address['LastName']; ?><br><?php echo $row_Address['Address1']; ?><br><?php echo $row_Address['Address2']; ?><br><?php echo $row_Address['City']; ?><br><?php echo $row_Address['State']; ?><br><?php echo $row_Address['Country']; ?><br><?php echo $row_Address['Pincode']; ?>
<br>
<strong>Email:</strong> <?php echo $row_Address['Pincode']; ?><br>
<strong> Phone:</strong> <?php echo $row_Address['Phone']; ?>
<br>
<br>
<button id="<?php echo $row_Address['ID']; ?>" type="submit" class="btn custombutton button--isi btn-primary">deliver to this address</button>
</p>
</div>
</div>
</div>
<?php } while ($row_Address = mysql_fetch_assoc($Address)); ?>
<!-- repeat address -->
</form>
因此,根据上述代码,每个用户重复地址。
我有一个ID为$row_Address['ID']
的按钮,因为所有ID都是唯一的。
点击我想将该ID带到下一页的任何按钮,即confirm.php
然后在确认.php
中使用$ _GET ['ID']的ID如何实现这一目标?
答案 0 :(得分:0)
简单方法是将$row_Address['ID']
作为隐藏值传递
<input type="hidden" name="customid" value="<?php echo $row_Address['ID']; ?> />
通过以下代码
在confirm .php
上检索该内容
$rowAddress = $_POST['customid'];