簡體   English   中英

如何通過下拉菜單的 href 傳遞 php 變量

[英]How do I pass the php variable through the href of the dropdown

我正在從搜索欄中獲取電子郵件並將其存儲在 $first 變量中。 后來我希望這個變量通過 href=cn.php 屬性傳遞。 我怎么能這樣做? 另請注意,我在這里使用引導程序,但跳過了包含文本。

<?php
$first = $_GET['email'];
?>
<!doctype html>
<html lang="en">
<div class="dropdown text-center">
<br><br>
<br><br>
<button type="button" class="col-4 btn btn-primary dropdown-toggle" data- 
toggle="dropdown">Select the Subject</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="CN.php?email=' . $first . '">Computer 
Networks</a>
</div>
</div>
</body> 
</html>

你的代碼看起來像-

<?php
$first = $_GET['email'];
?>
<!doctype html>
<html lang="en">
<div class="dropdown text-center">
<br><br>
<br><br>
<button type="button" class="col-4 btn btn-primary dropdown-toggle" data- 
toggle="dropdown">Select the Subject</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="CN.php?email=<?php echo $first;?>">Computer 
Networks</a>
</div>
</div>
</body> 
</html>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM