Connecting Tech Pros Worldwide Forums | Help | Site Map

Error when assembling a link

Matthew White
Guest
 
Posts: n/a
#1: Jul 17 '05
Hi,

I am assembling navigation links for an online article. The code works
fine for WIN IE 6 users, but not for NN4, or Mac IE5 users. When it
works, the resulting link looks like this:

http://www.mydomain.com/pr3/article2.php

On the machines with trouble, we get this:

/pr3/\\\\www.mydomain.com\\pr3\\article2.php

(Sorry for the dummy URL - I can't share the page yet)

As you can see, the link is now relative, and the slashes are working
out poorly. Is there a rule or technique I am missing that could make
this calculation work for the older browsers?

Thanks,

Matt


The relevant code is:

$page_num=1;
$page_location='http:\\\www.mydomain.com\\pr3\\';


$prev_page=$page_num-1;
$next_page=$page_num+1;
if ($prev_page == 0) {
$prev_page_link=NULL;
$prev_page_label=NULL;
}
else {
$prev_page_link = $page_location .'article'. $prev_page . '.php';
$prev_page_label = '< ' . $prev_page;
}
if ($next_page > $num_pages) {
$next_page_link=NULL;
$next_page_label=NULL;
}
else {
$next_page_link = $page_location .'article'. $next_page . '.php';
$next_page_label =$next_page . ' >';

echo ('<td width="380px" align="right"><h3> Article
Navigation:</h3></td>');
echo ("<td align=\"left\"><h3><a
href=\"$prev_page_link\">$prev_page_label</a> $nbsp $page_num $nbsp <a
href =\"$next_page_link\">$next_page_label</a></h3></td></tr>");
sk
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Error when assembling a link


Why are you using backslashes in $page_location? See the second line of
your script. http:// is valid. http:\\ is not. Windows IE is forgiving
about this sometimes. Other browsers and the HTTP spec are not.

Matthew White wrote:[color=blue]
> I am assembling navigation links for an online article. The code works
> fine for WIN IE 6 users, but not for NN4, or Mac IE5 users. When it
> works, the resulting link looks like this:
>
> http://www.mydomain.com/pr3/article2.php
>
> On the machines with trouble, we get this:
>
> /pr3/\\\\www.mydomain.com\\pr3\\article2.php[/color]

.....
[color=blue]
> The relevant code is:
>
> $page_num=1;
> $page_location='http:\\\www.mydomain.com\\pr3\\';[/color]

Closed Thread