Davico
Davico

Reputation: 93

Trouble passing variable through href php

In my php script I want to pass a variable through href. This is my code:

Script1.php

<td><a href="#top_opps?name=david" role="button" data-toggle="modal" ><?php echo $row['listings_views']; ?></a>  </td> 

But when I want to get the variable in the other script

Script2.php

<?php $var=$_GET['name']; 
echo $var; ?>

It shows me a error message. What could be my error?

Thank you in advance

Upvotes: 0

Views: 93

Answers (1)

Guillaume Lhz
Guillaume Lhz

Reputation: 904

Try this :

<td><a href="?name=david#top_opps" role="button" data-toggle="modal" ><?php echo $row['listings_views']; ?></a>  </td>

Upvotes: 5

Related Questions