and first off a thank you to all of the StackOverFlow users as I have found a lot of good answers here. I am a PHP/mySql newbie and I’m teaching myself from books and examples from others.
My problem: I have a mySQL DB with a URL column and a text column with a “clickme_text”, all the same DB row. From my website I want to be able to hit the “clickme” and then the DB URL will open in a new tab. Right now my PHP code works but it will not open the url in a new tab, it opens the new url in the same tab. I’m sure the answer is already out there somewhere, but I’ve gone crossed eye’d trying to create the html and PHP to both go to the new url and open in a new tab.
My DB url is “picture_link” and my clickme text in the DB is “picture_text”.
This code pulls the url and the “clickme text just fine from my DB, but it opens the url in the same tab.
echo '<li>' . '<a href="' . $row['picture_link'] . '">' . $row['picture_text'] . '</a>' . '</li>' . '<br/>';
I’ve tried a bunch of variations of something like this but it’s a no-go:
Echo ("<script> window.open(\""'<li>' . '<a href="' . $row['picture_link'] . '">' . $row['picture_text'] . '</a>' . '</li>' . '"\");
I know this html will open a new tab to “google” (for example):
<a href="http://google.com" target="_blank">Click Me!</a>
Do I need to create a var that points to my DB url, and then point my html to this var?
Any help on how to open my “clickme” DB url in a new tab is appreciated, thank you.