简体   繁体   中英

How do I pass the php variable through the href of the dropdown

I am fetching the email from the search bar and storing it in $first variable. Later I want this variable to be passed through the href=cn.php attribute. How can i do so? Also please note I am using bootstrap here, but skipped the inclusion text.

<?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>

Your code will look like-

<?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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM