如何在php中回显下面的代码?
<a href="cust_room/assign_room.php?cust_id=<?php echo $row_customer['cust_id']; ?>">Assign Room</a>
我确实试过这个,但收到了错误。
echo "<a href=\"cust_room/assign_room.php?cust_id=<?php echo $row_customer['cust_id']; ?>\">Assign Room</a>";
答案 0 :(得分:3)
尝试原因:echo
在另一个回声中!使用concat来回显$row_customer['cust_id']
<?php echo "<a href=\"cust_room/assign_room.php?cust_id=".$row_customer['cust_id'] ."\">Assign Room</a>"; ?>
答案 1 :(得分:3)
您无法在<?php
<?php
尝试以下代码:
echo "<a href=\"cust_room/assign_room.php?cust_id={$row_customer['cust_id']}\">Assign Room</a>";
而不是:
echo "<a href=\"cust_room/assign_room.php?cust_id=<?php echo $row_customer['cust_id']; ?>\">Assign Room</a>";