Problem When Linking Array Element To Itself

From: Date: Sat, 08 Feb 2003 20:50:39 +0000
Subject: Problem When Linking Array Element To Itself
Groups: php.general 
Request: Send a blank email to php-general+get-134894@lists.php.net to get a copy of this message
Hello, 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 Here's my code: for ($counter = 0; $counter < count($array_of_files); $counter++) { $category = $array_of_files[$counter]; echo "<a href='$category'>$category</a><br>"; } exit; } Here's an example of the variable $category before I place it in the <a href>: /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? I worked around this by placing '?file=$category' in the echo statement above. Just wondered if anyone had any better way to do this... Thanks in advance, Roger

« previous php.general (#134894) next »