Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

$_SERVER['PHP_SELF'] works in mozilla not ie5 1

Status
Not open for further replies.

dessie1981

Programmer
Joined
May 9, 2006
Messages
116
Location
GB
Hi Everyone,

Having a slight problem. I have a reset button on my page that
reloads a frame in the page, the button works fine in mozilla
firefox but does not work in ie5.

Here is the code i use for the button.

echo '<a href = "' . $_SERVER['PHP_SELF'] . '" TARGET=TITLE><INPUT TYPE="image" SRC="buttons/reset.jpg" HEIGHT="20" WIDTH="100" BORDER="0"></a>';
?>

If i change <a href = "' . $_SERVER['PHP_SELF']

to
e.g.
<a href = "test.html" ................

the windows navigates ok so this suggests to me that there is a problem with "$_SERVER['PHP_SELF']" portion of code.


Any help on this would be great.

Dessie
 
I disagree with your theory. $_SERVER['PHP_SELF'] is an element of a PHP predefined variable and is browser independent.

I recommend that you do in your a browser a "View source" to verify that the attibute is being populated and that there are no typographical problems with the HTML produced.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Hi,

I have done a view source and everything looks ok.
here is the section of source that is giving trouble

<td>
<a href = "/onlinestore/search.php" TARGET=TITLE><INPUT TYPE="image" SRC="buttons/reset.jpg" HEIGHT="20" WIDTH="100" BORDER="0"></a></td></tr>
</table>

The button is in a table.
 
There is apparantly nothing wrong with $_SERVER['PHP_SELF']. Unless that is the wrong URL path to the script. You might try using an absolute URL (one with the full " in it instead of a relative URL.



Your use of spaces wanders a bit. In some places you have "[space]=[space]" and in others not.

Your use of quotes wanders a bit, too. I can't state for a fact that "TARGET=TITLE" will cause a problem, but I'd fix it.

Consistency is a Good Thing.





Want the best answers? Ask the best questions! TANSTAAFL!
 
This is an html error. What you have is not a button, it's a submit element that is an image. By default, when you click on an image submit element, the form action executes and sends the coordinates of where in the image you've clicked on the next page. However, when you embed that in an anchor element, it gets confused -- which action to perform, the form or the anchor one. I guess FF interprets it the way you want to and IE does not. How about coding your html in a way that is less confusing?
 
dessie1981:

Vragabond is right. You should be using an <IMG> tag here, not an <INPUT type="image"> tag.



Vragabond:
Good eye.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Yes that did the trick , makes sense, thanks guys.

Dessie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top