0

I have this code. I want it to be clickable leading to another site in a new tab. Also when hover change color.

echo $query['name'];
hassan
  • 7,812
  • 2
  • 25
  • 36
Player PhB
  • 49
  • 1
  • 6
  • so what's issue? – Jigar Shah Jul 10 '17 at 08:13
  • [How can I echo HTML in PHP?](https://stackoverflow.com/questions/1100354/how-can-i-echo-html-in-php) – hassan Jul 10 '17 at 08:15
  • 1
    You want to learn the basics of html and how the web works. This is nothing we should answer, you should simply read and work through a basic tutorial. There are hundreds only a short google search away. – arkascha Jul 10 '17 at 08:16

2 Answers2

1

You can make it as a link give it id and change css

echo "<a href='another_page_url' id='checking'>".$query['name']."</a>";

On style sheet

 #checking:hover{
    color:yellow;
}
Saad Suri
  • 1,352
  • 1
  • 14
  • 26
1

You can do the following

echo "<a href='url' id='myLink' target='_blank'>".$query['name']."</a>";

This will open your url in a new tab.

And you can have the following styles to make it behave as a clickable text which changes its color to red on hover

#myLink {
    text-decoration: none; //remove this if you want a link
    color: black;  //remove this line if you want a blue link
    cursor: pointer;
}
 #myLink:hover{
    color:red;
}

Let me know if you require any further help

Amaan Iqbal
  • 761
  • 2
  • 9
  • 25