NameSilo

Terget_blank help

NamecheapNamecheap
Watch

abcde

Established Member
Impact
16
Hi guys,

How do I add target"_blank" to this link so that when people click on it... it will open in a new window.

PHP:
echo "<li><a href=".$row['link'].">".$row['title']."</a></li>";

Thanks
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
echo "<li><a href='".$row['link']."' target='_blank'>".$row['title']."</a></li>";
 
1
•••
Thanks, rep added.
 
0
•••
I'm being anal I know...but to keep continuity and to lessen the chances of making typos a good tip is to always keep your quotes the same. So if you use single quotes for php strings, use double quotes for html elements and keep it the same all the way through. You've mixed it up here with the a href.

No biggy, but i've found it's something that's saved my ass so many times before :p
 
0
•••
To adhere to the HTML spec, you should use double quotes, not single quotes round the href URI and frame-target. Single quotes are not legal here:

PHP:
echo "<li><a href=\"".$row['link']."\" target=\"_blank\">".$row['title']."</a></li>";
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Zero Commission
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back