script to open link by id in a new window

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mnemonik23
Forum Newbie
Posts: 3
Joined: Sat Feb 18, 2006 1:39 am

script to open link by id in a new window

Post by mnemonik23 »

Hi,

I'm looking for php or script that opens a link by provided id in a new window.

Something like this: http://www.blah-blah-blahh.com/linkto.php?id=17
So on the main page I will have a few links like above and when user clicks on any of them the main page stays the same, but links will be opened in a new window.

I assume the list of urls and id can be defined inside of the script or in the DB.

Does anybody have something like that to borrow?


Thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

That'd be a basic HTML link most often.

Code: Select all

<a href="blahblah" target="_blank">foo</a>
mnemonik23
Forum Newbie
Posts: 3
Joined: Sat Feb 18, 2006 1:39 am

Post by mnemonik23 »

feyd wrote:That'd be a basic HTML link most often.

Code: Select all

<a href="blahblah" target="_blank">foo</a>
The script is needed on purpose, to not display the actual link on the main page.
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Post by kaszu »

Easiest could be to save links into database (id, url),
then add link to your page <a href=".../linkto.php?id=17" _target="blank">...</a>
when page linkto.php is requested, check database for url for corresponing id,
make a redirect to url.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

mnemonik23 wrote:The script is needed on purpose, to not display the actual link on the main page.
What do you define as "actual link" in this case?
Post Reply