Current location: Hot Scripts Forums » Programming Languages » PHP » Link Problem


Link Problem

Reply
  #1 (permalink)  
Old 08-24-10, 01:44 AM
vinoth06 vinoth06 is offline
New Member
 
Join Date: Aug 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Link Problem

Hi friends,

Am having one link problem. Can any one please guide me to solve that issue.

ISSUE:

Am having config.php in home directory. In that i have give link.

PHP Code:

<?php
$flash1
='<a href=download/xxxx.doc>click</a>';
$flash2='"<a href=download/yyy.doc>Industry</a>"';
$flash3='"<a href=hwcfr/index.php>2010</a>"';
?>
and

In my home page i have called this variable.

Problem:
When I click that flash 1 link in home. it will download properly.(Yyyyy.com - yyyyy Resources and Information.This website is for sale!)

Suppose if i click that link in some other subpages like contact or support. its not downloading.Its showing the link like (Yyyy.com - clipart com Resources and Information.This website is for sale!contact/download/xxxx.doc.)

So please suggest me to download the file from exact location /download/xxxx.doc.

Thank you

Last edited by UnrealEd; 08-24-10 at 06:27 AM. Reason: fixed [php] tags
Reply With Quote
  #2 (permalink)  
Old 08-24-10, 06:28 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
it's best to use absolute linking. Instead of using download/xxxxx.doc, you should use Yyyyy.com - yyyyy Resources and Information.This website is for sale!
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #3 (permalink)  
Old 08-24-10, 07:10 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Easiest to do that is using the $_SERVER['HTTP_HOST'] function

so your links would be
PHP Code:

$flash1='<a href='.$_SERVER['HTTP_HOST'].'/download/xxxx.doc>click</a>'
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Reply With Quote
  #4 (permalink)  
Old 08-24-10, 08:20 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
don't forget to add the 'http://' part in front of $_SERVER['HTTP_HOST']
PHP Code:

 $flash1='<a href=http://'.$_SERVER['HTTP_HOST'].'/download/xxxx.doc>click</a>'
I always forget to do so, and things never work the first time I run them
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #5 (permalink)  
Old 08-24-10, 05:48 PM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
Quote:
Originally Posted by UnrealEd View Post
don't forget to add the 'http://' part in front of $_SERVER['HTTP_HOST']
PHP Code:

 $flash1='<a href=http://'.$_SERVER['HTTP_HOST'].'/download/xxxx.doc>click</a>'
I always forget to do so, and things never work the first time I run them
I thought I was the only one that made silly mistakes like that.
Reply With Quote
  #6 (permalink)  
Old 08-24-10, 11:34 PM
vinoth06 vinoth06 is offline
New Member
 
Join Date: Aug 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Oh god.. Its working.. Thank you guys.. Am proud to be here.. Am so happy guys....
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tips to increase link popularity.... John2010 Other Topics 7 12-15-11 05:51 AM
random link problem doogi PHP 18 03-04-09 01:00 AM
unknown problem - probably $session issue clantron PHP 6 03-19-06 01:36 PM
I'm confused..plz help Brittany23 CSS 5 05-24-05 11:52 AM
Multiple dropdown plus link problem bastiaan JavaScript 0 11-17-03 04:22 PM


All times are GMT -5. The time now is 08:19 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.