弹出<a href="#modal"> in java script

时间:2015-06-10 02:26:29

标签: javascript php popup

i have code :

<div id="modal" style="display:none">
 <?php $name = $_GET['name']; echo $name; ?> 
</div>

$sql = mysql_query(SELECT * FROM data);
while($data = mysql_fecth_row($sql)){
 echo "<a href=\"#modal?name=".$data[0]."\" id=\"modal_id\">name</a>;
}

this popup not show, but if I delete "?name=".$data[0]" this popup show but "$name" is empty.

how to this popup show and the "$data[0]" include in #modal..?

thanks

1 个答案:

答案 0 :(得分:0)

那是因为,以下是网址应该结束的内容:

你正在制作它:

file.php#id?parameter=value

你应该做的是:

<div id="modal" style="display:none">
 <?php
  $sql = mysql_query(SELECT * FROM data);
  $data = mysql_fecth_row($sql);
  echo $data[0];
 ?> 
</div>
<a href="#modal" id="modal_id">name</a>