By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,304 Members | 1,253 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,304 IT Pros & Developers. It's quick & easy.

Slashes in HTML - problem?!

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.