In PHP there is no way because the language does not work with this, but in HTML there is way and is wrong in your code. PHP is just an agent that is generating HTML for you, so the question has nothing to do with this language, unless it is something quite different from what is described.
To tag <a href>
is the one that determines that there will be a link there. It exists by itself, what you have inside can be several elements of HTML, can be a text or can be an image. HTML are tags one inside the other.
<a href = 'seu URL aqui'><img src = 'empat1.png'/></a>
If you want more readable:
<a href = 'seu URL aqui'>
<img src = 'empat1.png'/>
</a>
In the case of others just play this code with the name of the image you want to be displayed and the due link:
if ($formaCombate == "patk") {
if($patk1 > $patk2) echo "<a href = 'jogador1ganhou.html'><img src = 'venceu1.png'/></a>";
elseif ($patk1 < $patk2) echo "<a href = 'jogador2ganhou.html'><img src = 'venceu2.png'/></a>";
else echo "<a href = 'empatou.html'><img src = 'empat1.png'/></a>";
}
I put in the Github for future reference.
Documentations:
if($formaCombate == "patk") { if($patk1 > $patk2) { echo "Player 1 Won!" ; } elseif ($patk1 < $patk2) { echo "Player 2 win"; } Else ː echo "<img href='link'><img src='empat1.png'/>"; }
– Nathalia Scatena
This is all wrong
<img href='link'>
... it’s right something like this:<a href='link'><img src='imagem.jpg'/></a>
– Andrei Coelho
Got it, I’ll try, thanks
– Nathalia Scatena
Error on last line syntax :(
– Nathalia Scatena
Mark the answer that solved your problem as accepted see https://i.stack.Imgur.com/evLUR.png and because https://pt.meta.stackoverflow.com/questions/1078/como-e-por-que-aceitar-uma-resposta/1079#1079
– user60252
I still don’t really understand what you want... I think you could try to better explain the purpose or accept one of the answers below..
– Andrei Coelho
@Nathaliascatena Did any of the answers solve your question? Do you think you can accept one of them? Check out [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site (when you have enough score).
– Maniero