Forum Moderators: coopster

Message Too Old, No Replies

HTML working in .html file but not .php

         

Imy_S3

10:30 am on Mar 12, 2004 (gmt 0)

10+ Year Member



Hi

I have the code below that i have used in a file called example.html that works just fine.

However when i use it in a file called exmple.php it does not seem to work.

Does anyone know why it does not work in a .php file

Code is:
<a href="#top">text</a>

Thanks in advance

ukgimp

10:34 am on Mar 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if the code is within a script tag

<?php
print "<a href="#top">text</a>";
?>

or similar you will need to comment out the " as that stops the code execting.

So:

<?php
print "<a href=\"#top\">text</a>";
?>

brucec

2:46 am on Mar 13, 2004 (gmt 0)

10+ Year Member



Yeah, or if you are not a stickler for XHTML, leave out the " altogether.

coopster

3:36 pm on Mar 13, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Actually, the W3C recommends using quotation marks on attributes [w3.org] even when it is possible to eliminate them, not just for XHTML, but for HTML as well.

brucec

4:33 am on Mar 14, 2004 (gmt 0)

10+ Year Member



I agree with you Coopster. No argument from me. But, that's the whole concept of XHTML: to make valid HTML.. LOL.