473,386 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Slashes in HTML - problem?!

Hi there!

PHP version is 4.2.2

Sometimes my PHP page loads like this:

<body bgcolor=\"#FFFFFF\" text=\"#000000\" leftmargin=\"0\" topmargin=\"0\"
marginwidth=\"0\" marginheight=\"0\" bottommargin=\"0\">
<table height=\"100%\" width=\"770\" border=\"0\" cellspacing=\"0\"
cellpadding=\"0\" align=\"center\">
<tr valign=\"top\" height=\"10\">
<td>
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr valign=\"top\">

and page is of course displayed wrong.

However, when I refresh it, I simply get normal view (without any
backslashes before "):

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0" bottommargin="0">
<table height="100%" width="770" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr valign="top" height="10">
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
What this can be? Sometimes when I refresh it - it shows fine, then wrong,
then wrong, then fine, then wrong, then fine...

I really don't understand why this is happening. Any help?

TIA.

--
V.
Jul 17 '05 #1
4 1834
Vektor wrote:
Hi there!

PHP version is 4.2.2

Sometimes my PHP page loads like this:

<body bgcolor=\"#FFFFFF\" text=\"#000000\" leftmargin=\"0\" topmargin=\"0\"
marginwidth=\"0\" marginheight=\"0\" bottommargin=\"0\">
<table height=\"100%\" width=\"770\" border=\"0\" cellspacing=\"0\"
cellpadding=\"0\" align=\"center\">
<tr valign=\"top\" height=\"10\">
<td>
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr valign=\"top\">


I don't know why it works sometimes but doesn't sometimes, but I guess
that you're printing all this using a PHP print() statement, eg
print("<body bgcolor\"#ffffff\">");

it's easier to just break out of the code if you're printing a lot of
html in one go. If you need to insert some php variable in the middle
then you can just do something like <img src="<?= filePath ?>">

you can still use it to print html conditionally, eg

if (variable < 5)
{
?>
<p>the variable is less than "5", so this html is printing and I
don't need to escape anything.</p>
<?
}

Jul 17 '05 #2
Nick Howes schrieb:
I don't know why it works sometimes but doesn't sometimes, but I guess
that you're printing all this using a PHP print() statement, eg
print("<body bgcolor\"#ffffff\">");


The easier way:
print("<body bgcolor='#ffffff'>");

Regards,
Matthias
Jul 17 '05 #3
Hi Matthias,

[...]
The easier way:
print("<body bgcolor='#ffffff'>");

But ' is not allowed based on HTML standards AFAIK...isn't it?

kind regards.
Karl Heinz
--
Software Entwicklungs- und Beratungs Service http://www.soebes.de
Dipl.Ing.(FH) Karl Heinz Marbaise email: in**@soebes.de
Tel.: +49 (0) 241 / 16 91 210 ICQ#: 135949029
Jul 17 '05 #4
Karl Heinz Marbaise schrieb:
Hi Matthias,

[...]
The easier way:
print("<body bgcolor='#ffffff'>");

But ' is not allowed based on HTML standards AFAIK...isn't it?


It is!

We had a nice discussion in de.comm.infosystems.www.authoring.misc about
that. The discussion stopped immediatley when someone look at the
documenation and tried the validator at http://validator.w3.org. :-)

Regards,
Matthias
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Randell D. | last post by:
Folks, I'm using Apache/1.3.28 (SuSE 7.1, kernal 2.4) with PHP/4.3.2. I have the following code to help cleanse form data. function cleanData($sourceData, &$cleanData) { foreach($myData as...
13
by: lawrence | last post by:
A user writes this sentence: "It was the New Urbanist's nightmare of sprawl run amok." They input that and my PHP script hits it with addslashes() and then the sentence gets put in the database....
16
by: droog | last post by:
Hello! I have just started learning python and encountered a problem. All I wanted to do, was to open a text file search and count the number of occurances of a single word and print that count....
10
by: Carlos Ribeiro | last post by:
Hello all. I'm sending this to the list because I would like to know if someone else has ever stumbled across this one, and also because one possible solution is to patch, or simply "decorate",...
7
by: Alex | last post by:
I'm new to Oracle, so this question may sound silly. I have been given a list of Oracle tables (they may be views, I'm not sure) that are available to me. I can run simple SQL select statements...
5
by: Treetop | last post by:
I have noticed with various codes that the slashes are not consistent. Is there a reason for this. For example </td> </\td> <\/td> <td /> what is the difference with these tags?
0
by: Henrik de Jong | last post by:
Hello, I'm using radeditor. When I set the html-property to the text wich has to be altered, it gives me an error when try to save the new values of the html-proterty. It occurs only when i'm...
0
by: LU | last post by:
Using VS.Net 03 v.7.1.3 and ASP.NET I'm geting help with javascript and the person helping me is asking me to " get rid of your XHTML ending tag slashes, use a HTML STRICT DOCTYPE" or to use the...
7
by: pyluke | last post by:
I'm parsing LaTeX document and want to find lines with equations blocked by "\", but not other instances of "\" so, in short, I was to match "\" to add to this, I also don't want lines that...
8
by: mijn naam | last post by:
Trying to find info about this, but searching for '///' or for 'tripple slash' doesn't provide relevant answers. Can anyone please point me in the right direction? A simple script, called...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.