Re: Storing html in a variable - how?
| From: | Jeff Gannaway | Date: | Sat, 22 Jul 2000 09:52:06 +0000 |
| Subject: | Re: Storing html in a variable - how? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7677@lists.php.net to get a copy of this message | ||
At 12:52 PM 7/22/00 +0100, Jon Lawrance wrote:
>This code doesn't work:
>
>$body="<td width="26%" height="286" valign="top"
>bgcolor="#99CC00">
> <p><font face="Verdana, Arial, Helvetica,
> sans-serif"><b><font
>size="2">Name<br>
> Position<br>
> Company<br>
> Phone<br>
> Email<br>
> Source<br>
> Country<br>
> Type of project<br>
> Notes</font></b></font></p>
> </td>"
You need to excape the quotation marks like so :
$body="<td width=\"26%\" height=\"286\" and so on
if you're copying from an HTML editor and pasting into the PHP script, have
your PHP script in a text editor with a search and replace feature (like MS
Word Pad). After you've pasted the code, highlight the part within the
$body = " .....pasted HTML...... ", then replace " with \"
If you're getting info from a form where the may have typed in a quotation
mark, before doing anything else with the variable use
addslashes ($FormVariable) to automatically add escape slashes to
quotations and other offending characters.
Good luck,
Jeff Gannaway