Re: Problem When Linking Array Element To Itself

From: Date: Sat, 08 Feb 2003 21:10:49 +0000
Subject: Re: Problem When Linking Array Element To Itself
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-134897@lists.php.net to get a copy of this message
I have an array called $array_of_files. I want to echo each element of that array as a link to itself. That way when I click on an element I can send it as an actual value /usr/local/plesk/apache/vhosts/myserver.com/httpdocs/php/categories/links1.txt Once I place the variable $category inside the <a href> statement it looks like this: http://www.myserver.com/usr/local/plesk/apache/vhosts/myserver.com/httpdocs/php/categories/links1.txt Why is it the <a href> adds 'http://www.myserver.com' to the front of the value of $category?
It is the browser trying to help by completing what it sees as a relative link.
I worked around this by placing '?file=$category' in the echo statement above. Just wondered if anyone had any better way to do this...
Looks like an excellent way. Other ways might include making associated arrays but i see no reason to do it differently. By the way, i don't know what you do with the rest of the code but what happens if some joker links to '?file=etc/passwd' ?

« previous php.general (#134897) next »