Pop Up with <a href=#modal> in java script

236 views Asked by At

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

There are 1 answers

0
Cai Haoyang On

That's because, here is what a url should end with:

And you are making it:

file.php#id?parameter=value

And what you should have done is:

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