Megool
Megool

Reputation: 999

Internet Explorer's Weird Behavior With PHP

I have a php code list.php working differently on Internet Explorer 9, 10, 11 and chrome.

I'm listing pagination using <a href=$_SERVER[PHP_SELF]?no=$next_list>. In Chrome and IE 11, this code works fine, which means when I click the link I am directed to mydomainname.com/list.php?no=10.

But in IE 9 and 10, I am directed to list.php?no=10 and am encountered by 'page not found' error. In other words, I am directed to a solid 'file name' instead of 'domain address + file name'.

Another behavior I noticed in IE 9 and 10 before I click the pagination link is that the address reads mydomainname.com//list.php.

I've included html5shiv.js and respond.js for IE performances.

Is it something like $_SERVER or PHP_SELF not configured properly for old IE? I would greatly appreciate any help. Thanks!

Upvotes: 0

Views: 109

Answers (2)

sodawillow
sodawillow

Reputation: 13176

<?php

$next_list = 12;

?>
<body>
    <?php echo "<a href=$_SERVER[PHP_SELF]?no=$next_list>test</a>"; ?>
</body>

I couldn't reproduce the issue with the above test code, maybe you have a link to provide ?

Upvotes: 1

StudioTime
StudioTime

Reputation: 23979

Try this:

<a href=/$_SERVER[PHP_SELF]?no=$next_list>

note the "/" - this will bring you always back to root

Is that what you mean?

Upvotes: 1

Related Questions