Reputation: 25304
$html=<<<html
<tr><td>$i.<a href="offtask.php?taskid=$taskid target='_blank' ">$title</a></td><td>$count</td><td class="nowrap">$locationtext</td></tr>
html;
echo $html;
How to open a new window in the code above? target='_blank'
doesn't work.
Upvotes: 2
Views: 46500
Reputation: 1
I have tried putting the target="_blank" in a number of places, this code comes from a rss reader but I don't want people to click and leave my site but to just open another tab
if($linked ) $msg = '<a href="'.$link.'" class="srssfetcher-link">'.$msg.'</a>'; // Puts a link to the posts
Upvotes: 0
Reputation: 94167
The reason it's not working is because you haven't separated your link attributes properly. Try outputting the href
and the target
with proper separation (ie, close your quotes).
Use this:
<a href="offtask.php?taskid=$taskid" target='_blank'>
instead of
<a href="offtask.php?taskid=$taskid target='_blank' ">
Upvotes: 1
Reputation: 162801
Your target
attribute is stuck inside your href
attribute. Try this:
$html=<<<html
<tr><td>$i.<a href="offtask.php?taskid=$taskid" target="_blank">$title</a></td><td>$count</td><td class="nowrap">$locationtext</td></tr>
html;
echo $html;
Upvotes: 10
Reputation: 58931
look at the code output by that code. It will look like this:
<tr><td>$i.<a href="offtask.php?taskid=$taskid target='_blank' ">$title</a></td><td>$count</td><td class="nowrap">$locationtext</td></tr>
and you want it to be
<tr><td>$i.<a href="offtask.php?taskid=$taskid" target="_blank">$title</a></td><td>$count</td><td class="nowrap">$locationtext</td></tr>
That is:
<a href="url" target="_blank">link</a>
Upvotes: 3