我正在建立一个网站,我必须在其中存储多个用户的地址,并且一个客户可以拥有多个地址。因此,当客户登录时,他可以选择一个地址并继续前进。我正在使用循环显示客户的多个地址,并使用单选按钮从多个地址中选择一个地址,但是我的代码仅获得最后一个循环结果,而且我不知道如何从单选按钮中选择多个值。我想我搞砸了。请帮忙。
$query = "SELECT `name`,`mobileno`, `address`, `pincode`, `landmark`, `state` FROM `user_address`
WHERE customer_id = (SELECT `customer_id` FROM `user` WHERE email = '{$_SESSION['email']}')";
$records=mysqli_query($conn,$query);
while($row=mysqli_fetch_assoc($records)){
echo "<label class='useradr-cont'>";
echo "<input type='radio' checked='checked' name='useradr-check'>";
echo "<span class='checkmark'></span>";
echo "<div class='useradr-body'>";
echo "<span style='font-weight:bold;font-size:16px;'>".$row['name']."</span><br>
<input type='hidden' name='cname' value=".$row['name'].">";
echo "<span>Mobile No - ".$row['mobileno']."</span><br><br>
<input type='hidden' name='cmobno' value=".$row['mobileno'].">";
echo "<span>Address - ".$row['address']."</span><br>
<input type='hidden' name='cadr' value=".$row['address'].">";
echo "<span>Pincode - ".$row['pincode']."</span><br>
<input type='hidden' name='cpin' value=".$row['pincode'].">";
echo "<span>Landmark - ".$row['landmark']."</span><br>
<input type='hidden' name='clandmark' value=".$row['landmark'].">";
echo "<span>State - ".$row['state']."</span><br>
<input type='hidden' name='cstate' value=".$row['state'].">";
echo "</div>";
echo "</label>";
}