簡體   English   中英

無法通過導航欄的下拉菜單中的ID

[英]unable to pass id in the dropdown menu of my navigation bar

我無法在導航欄的下拉菜單中傳遞ID。 這是我的代碼

 <?php
echo $date=$_GET['id'];echo"</br>";
  echo $d=$_GET['id1'];
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("vas1",$con);
?>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<ul id="nav" class="drop">



   <li><a href='calls1.php?id=$date&id1=$d' class="style1">View Trends</a></li>

$ date和$ d正確地回傳了我上一頁傳遞的內容,但是當我單擊“ View Trends”時,確實打開了calls1.php,但沒有傳遞ID。 這是calls1.php的URL,以顯示其如何傳遞

http://localhost/vas1/calls1.php?id=$date&id1=$d

但是應該像這樣:

http://localhost/vas1/calls1.php?id=20121110&id1=November%202012

我該怎么辦...。

打開PHP標簽。 您必須打開PHP標簽才能在HTML中回顯PHP變量。

<li><a href='calls1.php?id=<?=$date;?>&id1=<?= $d; ?>' class="style1">View Trends</a></li>

將此放置在calls1.php之上,

 <?php
 $date=$_GET['id'];echo"</br>";
$d=$_GET['id1'];
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("vas1",$con);
?>

暫無
暫無

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

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