如何通过下拉列表的 href 传递 php 变量
How do I pass the php variable through the href of the dropdown
我正在从搜索栏中获取电子邮件并将其存储在 $first 变量中。稍后我希望通过 href=cn.php 属性传递此变量。我该怎么做?另请注意,我在这里使用 bootstrap,但跳过了包含文本。
<?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>
我正在从搜索栏中获取电子邮件并将其存储在 $first 变量中。稍后我希望通过 href=cn.php 属性传递此变量。我该怎么做?另请注意,我在这里使用 bootstrap,但跳过了包含文本。
<?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>