0

I try to make my button open a link on a new page this link is stored in the database i have done the button to open the link but on the same page and i need to open it a new page. i have tried to insert but continue to open on the same page. This is my code

<button type="button" onclick="location.href='<?php echo $data['link']; ?>'" target="_black" class="w-100 btn btn-lg btn-primary">View To Win The Credits</button>
  • Aside from the "blank/black" typo, your problem is that you're opening it with Javascript and thus `target` is ignored. Why don't you simply make it an `` element and just style it as a button? – El_Vanja Feb 18 '21 at 17:06
  • After analyzed what you all says , i have search for this solution with the a element and is perfect tank you all for the great help , here is the link with the solution. [link]https://stackoverflow.com/questions/710089/how-do-i-make-an-html-link-look-like-a-button – David still Feb 18 '21 at 17:18

2 Answers2

0

put target="_blank" instead of target="_black"

https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_link_target

  • 1
    We don't normally answer typo questions, because they are of little value to future readers. The proper procedure would be leaving a [comment](https://stackoverflow.com/help/privileges/comment) and [flagging](https://stackoverflow.com/help/privileges/flag-posts) the question as a typo. I know you don't have the required reputation to do so, but please be patient and in the future, avoid answering typo questions. – El_Vanja Feb 18 '21 at 16:53
0

You have to use target="_blank". Check the spelling, you have used black.

it should be - '" target="_blank" class="w-100 btn btn-lg btn-primary">View To Win The Credits

Ankur29
  • 16
  • 3
  • Ty for the help i should verify more ofen my spelling tank you for the help – David still Feb 18 '21 at 16:47
  • We don't normally answer typo questions, because they are of little value to future readers. The proper procedure would be leaving a [comment](https://stackoverflow.com/help/privileges/comment) and [flagging](https://stackoverflow.com/help/privileges/flag-posts) the question as a typo. I know you don't have the required reputation to do so, but please be patient and in the future, avoid answering typo questions. – El_Vanja Feb 18 '21 at 16:53
  • @Ankur29 I did the change But not solve the problem of the link continue open in same window – David still Feb 18 '21 at 16:59