By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,046 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,046 IT Pros & Developers. It's quick & easy.

Error when assembling a link

P: n/a
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>");
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
sk
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:
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
.....
The relevant code is:

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


Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.