Jump to content

Recommended Posts

Hey,

How can I make it so full HTML code (with quotes and everything) can be stored in a PHP variable.

This is the kind of HTML i will be storing is

[code]
<object height="525" width="700"><param name="movie" value="../game-movie/motion.swf" />
<embed src="../game-movie/motion.swf" height="525" width="700"></object>
[/code]

or maybe

[code]
<embed style="width: 400px; height: 326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=4092819850988013212" quality="best" bgcolor="#ffffff" scale="noScale" salign="TL" flashvars="playerMode=embedded" align="center">
[/code]

I tried this

[code]
<?php

$moviehtml = addslashes( "<object height="525" width="700"><param name="movie" value="../game-movie/motion.swf" />
<embed src="../game-movie/motion.swf" height="525" width="700"></object>" );

echo $moviehtml;
echo "testing...";

?>
[/code]
But it doesn't even output the "testing..."

Thanks for the read and if you don't get what I'm saying, please reply.

-Joel
Link to comment
https://forums.phpfreaks.com/topic/36423-html-in-php-variables/
Share on other sites

Add slashes doesn't work like that :(...

It would cause an error because of the quotes... I suggest something like

$moviehtml = '<object height="525" width="700"><param name="movie" value="../game-movie/motion.swf" />
<embed src="../game-movie/motion.swf" height="525" width="700"></object>';

Or if your variable is going to have single quotes, I suggest using $tag = "<htmltag var=\"val\">";
Link to comment
https://forums.phpfreaks.com/topic/36423-html-in-php-variables/#findComment-173282
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.