FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


php tidy?





taytay
Why is PHP automatically changing my "&lt;" and similar tags automatically to "<" when it processes a page? It's driving me crazy! How can I bend a website to my will when it has a mind of it's own?!?!

-Taylor
alem
you can type "&amp;lt;" . then it is ok.
taytay
but PHP is processing even &amp;lt; and making it &lt;. When I view the source the server gives my web browser it does this. even if I accidentally do something like <lol tar gz ha>, it turns it into <lol tar="" gz="" ha="">


gar

and I've tested this on IE7, Firefox 2 & 3, and Safari. It's not a browser problem, it's a server jig. lol.
MrBlueSky
Can you give a small sample piece of code where this happens?
taytay
gosh, I get it all typed up and then the power blinks and I lose it. curses....

let me try to explain.. Again. What I am trying to do takes up 3 separate php pages. There's the Form page, the submission page, and the preview page. And i'm using frames... here I'll draw an example


__________________________
-------------Form frame
__________________________

-----Preview/Submission frame



__________________________


When the form is submitted, it loads in the bottom frame to the submission page, where the collected data is put into a SESSION variable. Once complete it redirects the frame back to the Preview page, where PHP echo's the SESSION variants to the page.

the preview page's setup in PHP is similar to this:
Code:
<?php
session_start();
include ('/PATH~/1top.php');

echo $_SESSION['inputtextarea1'];

include ('/PATH~/2bot.php');
include ('/PATH~/tracker.php');

?>


the includes "1top" and "2bot" are the tops and bottoms to the pages layout style. and "tracker" is, well a google tracker.

here's the stupidly interesting part. I just told PHP to echo(or print, it works the same, I've tried) inputtextarea1 to that spot. BUT! if that data has any <style> or <javascript> tags and information in it, it automatically bumps that select part of the 'inpuittextarea1' data to inside the <head></head> tags at which are included from "1top.php". AND it leaves the rest of the SESSION data right where I told it to go.


I also have my Form Page setup, so in the event the client Refreshes the entire page, it will echo(or again, print) 'inputtextarea1' to the <textarea>field like I want it to, but it STILL automatically processes '&lt;' or '&gt;' to '<' and '>'. it even takes '=' and makes it '<'!! I can't get around it nd it's screwing up my work! It doesn't matter if I add my own str_replace() filters inside my php code to change '&lt;' or '<' back and forth, because PHP has a mind of it's own and doesn't care!



any idea's?

Bondings? Someone? Anyone with extensive knowledge of all the 'function=' that come with PHP? this is tiresome.
MrBlueSky
There isn't any setting on frihost which makes PHP change &lt; to '<', etc. If I put up this little PHP script, it does what you would expect it does: http://www.mrbluesky.frih.net/test/test.php

Code:

<html><head>
<title>Bla</title>
</head>

<body>


  <?php
  echo "&lt;b&gt;hello&lt;/b&gt;";
  ?>


</body>
</html>
taytay
a thought just occured to me... could having
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

in my pages be doing this... I'm removing it now to see if it effects anything.



ah ha. I just turned off my styles, so now I have Just my body content, and it shows &quot; in the source other than ".

Here's the page I'm testing this on. It's a simple page I made which saves the form data to MySQL. Play around if you want. Right now it just doesn't have a style though. I'll be playing with it through out the day to see what caused this.

I still haven't tested the <style> tag though. It might still move around, I'll test that after I eat dinner.

___________________

EDIT

the /text.php page is still working like I said, but the one I noticed this on(which uses sessions) is still buggin' out. garr
Related topics
http://tuvanonline.com/library/index.php
PHP-Nuke platium?
PHP Write to line
Anyone good with PHP-NUKE?
PHP safety?
req: PHP to list files in directory, and link to them
php admin and mysql admin console
Mysql And PHP HELP PLZ
Great php editor
Script php about gallery
File upload with PHP, Build an upload database for your site
[php scripts ] phpweather&email
Including With PHP
help me upgrade php to 5.
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.