Re: backslashes added to quotes when reading from form
From: Oli Filth (oli_filth_at_eatspam.coldmail.com)
Date: 12/04/04
- Previous message: Janwillem Borleffs: "Re: Laufschrift mit xml Inhalt"
- In reply to: paul: "Re: backslashes added to quotes when reading from form"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 04 Dec 2004 04:32:29 GMT
Think about what's going on here! The print command sends the contents of
$comment straight to the browser. You're not asking PHP to evaluate/execute the
contents (e.g. by using eval()), so even if it contains PHP code, it won't be
executed at the server.
The browser receives the contents of $comment and tries to interpret it as HTML.
So anything that was HTML in the original file will appear as you'd expect (i.e.
formatted), and anything in PHP tag delimiters (i.e. <?php ... ?>) is
interpreted as an unknown HTML tag and hence is not displayed.
Oli
paul wrote:
> Oh no they support php, it's just when I post the contents of a text
> file containing some php code, it is not interpreted. This is the code I
> extract it with:
>
> # extract comments from text file to screen
> if (file_exists ("$basename.txt")){
> $comment = file_get_contents("$basename.txt");
> print $comment;
> }
>
> If the content is:
>
> <?php print "hello"; ?>
>
> it comes up blank, though I thought before it printed out that code
> verbatim.
>
> html code like test does get interpreted as html
> though.
>
>
> Harrie Verveer wrote:
>
>> if you used <? as open tag, try using <?php
>>
>> if that doesn't work, I'm afraid your hosting provider doesn't support
>> PHP :(
>>
>> paul wrote:
>>
>>> Interestingly, I tried putting some php code in my form and it didn't
>>> execute. The html code gets properly formatted but the php just comes
>>> out as raw text.
- Previous message: Janwillem Borleffs: "Re: Laufschrift mit xml Inhalt"
- In reply to: paul: "Re: backslashes added to quotes when reading from form"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|