Re: Escaping Characters

From: Date: Wed, 25 Apr 2001 15:00:16 +0000
Subject: Re: Escaping Characters
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-50314@lists.php.net to get a copy of this message
My previous post is a bit misleading. ""Wade"" <wwilliams@myoptionvalue.com> wrote in message news:9c6dcb$h8e$1@toye.p.sourceforge.net... > Aside from " (quotes), which HTML characters should be preceded with a \ > (backslash) to avoid parsing errors? No and Yes. NO: You don't have to escape PHP special characters in HTML. YES: You need to escape PHP special characters in string. (Generally speaking) > > I have the following, which I have in an .inc file outside my web root. I > have tried sticking the \ in front of the # (pound) and the = (equal) -- not > out of any reason, but more out of frustration. I have been sticking > dropdown menu in inc files with no troubles, but this is the first table > I've tried to stick in there. I'm trying not to ask questions here until > after trying to find an answer in PHP.net, but I've had no luck on this one. > <? > <table width=\"90%\" border=\"0\" cellspacing=\"0\" > cellpadding=\"0\" > align=\"center\"> > <tr bgcolor=\"#ebebd6\"> > > .... > ?> You cannot write HTML like this in PHP code. You can write HTML in conditional statement as my previous post. You also could write it as follows $html =<<<EOH <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr bgcolor="#ebebd6"> .... EOH; print $html; Heredoc does not require to escape ", ',newline,etc even if it is similar to string with " or '. Regards, -- Yasuo Ohgaki

« previous php.general (#50314) next »