Jump to content

[SOLVED] How to display HTML code in an echo Command


ElectricShaka

Recommended Posts

I have html code like the following stored in a MySQL database.

 

<style type="text/css">.fcsS{}</style>
	  <style type="text/css">

td.columnsWidening img,td.columnsWidening  {max-width:100% !important;width: expression(this.width > 400 ? 400 : true);}
td.columnsWidening img,td.columnsWidening  {max-width:100% !important;width: expression(this.width > 400 ? 400 : true);}</style><style type="text/css">


{ Background Properties }
table, tr, td { background-color:transparent; border:none; border-width:0;}
body {
background-color:c6c1c1;
background-image:url('www.epiklayouts.com/images/carmen.jpg');
background-attachment:fixed;
background-position:center center;
background-repeat:repeat;
border-top-width:0px;
border-bottom-width:0px;
border-left-width:0px;
border-right-width:0px;
border-color:none;
border-style:solid;
padding-left:0px;
padding-right:0px;
}

.FreeCodeSource.com { Table Properties }
table table { border: 0px }
table table table table{border:0px}
table, tr, td { background-color:transparent; border:none; border-width:0;}
table table table {
border-style:solid;
border-width:3;
border-color:000000;
background-color:C8C8C8;
background-image:url('Enter Image URL');
background-repeat:repeat;
background-attachment:fixed;
background-position:top center;
filter:alpha(opacity=80); -moz-opacity:0.80; opacity:0.80; -khtml-opacity:0.80; 
}
table table table table td {filter:none;}

{ Text Properties }
table, tr, td, li, p, div {}
.btext, .orangetext15, .nametext, .whitetext12 {
  font-family:georgia !important; color:3C05A2 !important;   font-weight:bold; font-style:italic; 
  }


.blacktext10, .blacktext11, .blacktext12, .lightbluetext8, .redtext, .redbtext, .text {
  color:3C05A2 !important;
  font-weight:bold;
  font-style:italic; 
  }

{ Link Properties }
a:active, a:visited, a:link {
color:0000FF !important;
font-weight:normal;
font-style:italic;
}
a:hover {color:FFFFFF !import
ant;
font-weight:bold;
font-style:italic;
text-decoration:line-through; text-decoration:underline;
}

{ Tweaks }

</style><style type="text/css">
.commentlinks a { font-weight:normal; font-size:9px; }
</style><style type=text/css>
         #tkn_leaderboard{visibility:visible !important; display:inline !important;}
        body TABLE TD DIV#header_gae {     VISIBILITY: visible !important;}
        
        body DIV DIV select#profileaction{VISIBILITY: visible !important; display:inline !important; position:static; WIDTH: 125px !important;}
        body DIV DIV DIV#profilelinks{ VISIBILITY: visible !important; display:inline !important; position:static; padding-right:15px; }
        
        body DIV TABLE TD DIV#googlebar 
        {
            VISIBILITY: visible !important;            
            display:block !important;
            position:relative;
            z-index:1000;
        }
       
         body DIV DIV form #q,
         body DIV DIV form #t,
         body DIV DIV form #submitBtn,
         body DIV DIV form #imgGoogle         
        {
            VISIBILITY: visible !important; 
            display:inline !important; 
            position:static;
        }

</style><style type="text/css">
	body, html {visibility:visible !important; display:block !important}
</style>					<br>

<style type="text/css">.fcsE{}</style>
<a href="http://www.epiklayouts.com" target=_blank>Myspace Layouts</a><br>
<div style="position:absolute;left:0px;top:0px;width:88px;height:31px;"><a href="http://www.epiklayouts.com">EpikLayouts.com</a></div>

 

This is my php code to pull the code from the database and print it in a text field. The problem is that not all the code shows up in the text field. Is there a command to tell the user's browser somehow to not read the html code as html code and just to read it as a long string?

 

/* display theme code */				
echo "<td align='center'><b>Theme Code</b>"; ?> <br/> <?php echo "<textarea rows='10' cols='40' name='themeCode'
value='{$row['themeCode']}'</textarea></td>\n";

 

Here is what actually shows up for the user to see. You can see there is a lot missing from above.

</style><style type="text/css">
.commentlinks a { font-weight:normal; font-size:9px; }
</style><style type=text/css>
         #tkn_leaderboard{visibility:visible !important; display:inline !important;}
        body TABLE TD DIV#header_gae {     VISIBILITY: visible !important;}
        
        body DIV DIV select#profileaction{VISIBILITY: visible !important; display:inline !important; position:static; WIDTH: 125px !important;}
        body DIV DIV DIV#profilelinks{ VISIBILITY: visible !important; display:inline !important; position:static; padding-right:15px; }
        
        body DIV TABLE TD DIV#googlebar 
        {
            VISIBILITY: visible !important;            
            display:block !important;
            position:relative;
            z-index:1000;
        }
       
         body DIV DIV form #q,
         body DIV DIV form #t,
         body DIV DIV form #submitBtn,
         body DIV DIV form #imgGoogle         
        {
            VISIBILITY: visible !important; 
            display:inline !important; 
            position:static;
        }

</style><style type="text/css">
	body, html {visibility:visible !important; display:block !important}
</style>					<br>

<style type="text/css">.fcsE{}</style>
<a href="http://www.epiklayouts.com" target=_blank>Myspace Layouts</a><br>
<div style="position:absolute;left:0px;top:0px;width:88px;height:31px;"><a href="http://www.epiklayouts.com">EpikLayouts.com</a></div>'

 

For reference the page I'm currently working on can be found here if you select a category. http://www.epiklayouts.com/layouts.php

 

Thanks for any help you can provide!

Link to comment
Share on other sites

That made most of the code show up thanks. However it still cuts out the very beginning of the code which should say:

<style type="text/css">

 

This is what shows up now in full:

.fcsS{}</style>
	  <style type="text/css">

td.columnsWidening img,td.columnsWidening  {max-width:100% !important;width: expression(this.width > 400 ? 400 : true);}
td.columnsWidening img,td.columnsWidening  {max-width:100% !important;width: expression(this.width > 400 ? 400 : true);}</style><style type="text/css">


{ Background Properties }
table, tr, td { background-color:transparent; border:none; border-width:0;}
body {
background-color:c6c1c1;
background-image:url('http://epiklayouts.com/Myspacelayouts/sexygirls/alba1.jpg');
background-attachment:fixed;
background-position:center center;
background-repeat:repeat;
border-top-width:0px;
border-bottom-width:0px;
border-left-width:0px;
border-right-width:0px;
border-color:none;
border-style:solid;
padding-left:0px;
padding-right:0px;
}

.FreeCodeSource.com { Table Properties }
table table { border: 0px }
table table table table{border:0px}
table, tr, td { background-color:transparent; border:none; border-width:0;}
table table table {
border-style:solid;
border-width:3;
border-color:000000;
background-color:C8C8C8;
background-image:url('Enter Image URL');
background-repeat:repeat;
background-attachment:fixed;
background-position:top center;
filter:alpha(opacity=80); -moz-opacity:0.80; opacity:0.80; -khtml-opacity:0.80; 
}
table table table table td {filter:none;}

{ Text Properties }
table, tr, td, li, p, div {}
.btext, .orangetext15, .nametext, .whitetext12 {
  font-family:georgia !important; color:3C05A2 !important;   font-weight:bold; font-style:italic; 
  }


.blacktext10, .blacktext11, .blacktext12, .lightbluetext8, .redtext, .redbtext, .text {
  color:3C05A2 !important;
  font-weight:bold;
  font-style:italic; 
  }

{ Link Properties }
a:active, a:visited, a:link {
color:0000FF !important;
font-weight:normal;
font-style:italic;
}
a:hover {color:FFFFFF !import
ant;
font-weight:bold;
font-style:italic;
text-decoration:line-through; text-decoration:underline;
}

{ Tweaks }

</style><style type="text/css">
.commentlinks a { font-weight:normal; font-size:9px; }
</style><style type=text/css>
         #tkn_leaderboard{visibility:visible !important; display:inline !important;}
        body TABLE TD DIV#header_gae {     VISIBILITY: visible !important;}
        
        body DIV DIV select#profileaction{VISIBILITY: visible !important; display:inline !important; position:static; WIDTH: 125px !important;}
        body DIV DIV DIV#profilelinks{ VISIBILITY: visible !important; display:inline !important; position:static; padding-right:15px; }
        
        body DIV TABLE TD DIV#googlebar 
        {
            VISIBILITY: visible !important;            
            display:block !important;
            position:relative;
            z-index:1000;
        }
       
         body DIV DIV form #q,
         body DIV DIV form #t,
         body DIV DIV form #submitBtn,
         body DIV DIV form #imgGoogle         
        {
            VISIBILITY: visible !important; 
            display:inline !important; 
            position:static;
        }

</style><style type="text/css">
	body, html {visibility:visible !important; display:block !important}
</style>					<br>

<style type="text/css">.fcsE{}</style>
<a href="http://www.epiklayouts.com" target=_blank>Myspace Layouts</a><br>
<div style="position:absolute;left:0px;top:0px;width:88px;height:31px;"><a href="http://www.epiklayouts.com">EpikLayouts.com</a></div>)

 

and this is what it should be:

<style type="text/css">.fcsS{}</style>
	  <style type="text/css">

td.columnsWidening img,td.columnsWidening  {max-width:100% !important;width: expression(this.width > 400 ? 400 : true);}
td.columnsWidening img,td.columnsWidening  {max-width:100% !important;width: expression(this.width > 400 ? 400 : true);}</style><style type="text/css">


{ Background Properties }
table, tr, td { background-color:transparent; border:none; border-width:0;}
body {
background-color:c6c1c1;
background-image:url('www.epiklayouts.com/images/carmen.jpg');
background-attachment:fixed;
background-position:center center;
background-repeat:repeat;
border-top-width:0px;
border-bottom-width:0px;
border-left-width:0px;
border-right-width:0px;
border-color:none;
border-style:solid;
padding-left:0px;
padding-right:0px;
}

.FreeCodeSource.com { Table Properties }
table table { border: 0px }
table table table table{border:0px}
table, tr, td { background-color:transparent; border:none; border-width:0;}
table table table {
border-style:solid;
border-width:3;
border-color:000000;
background-color:C8C8C8;
background-image:url('Enter Image URL');
background-repeat:repeat;
background-attachment:fixed;
background-position:top center;
filter:alpha(opacity=80); -moz-opacity:0.80; opacity:0.80; -khtml-opacity:0.80; 
}
table table table table td {filter:none;}

{ Text Properties }
table, tr, td, li, p, div {}
.btext, .orangetext15, .nametext, .whitetext12 {
  font-family:georgia !important; color:3C05A2 !important;   font-weight:bold; font-style:italic; 
  }


.blacktext10, .blacktext11, .blacktext12, .lightbluetext8, .redtext, .redbtext, .text {
  color:3C05A2 !important;
  font-weight:bold;
  font-style:italic; 
  }

{ Link Properties }
a:active, a:visited, a:link {
color:0000FF !important;
font-weight:normal;
font-style:italic;
}
a:hover {color:FFFFFF !import
ant;
font-weight:bold;
font-style:italic;
text-decoration:line-through; text-decoration:underline;
}

{ Tweaks }

</style><style type="text/css">
.commentlinks a { font-weight:normal; font-size:9px; }
</style><style type=text/css>
         #tkn_leaderboard{visibility:visible !important; display:inline !important;}
        body TABLE TD DIV#header_gae {     VISIBILITY: visible !important;}
        
        body DIV DIV select#profileaction{VISIBILITY: visible !important; display:inline !important; position:static; WIDTH: 125px !important;}
        body DIV DIV DIV#profilelinks{ VISIBILITY: visible !important; display:inline !important; position:static; padding-right:15px; }
        
        body DIV TABLE TD DIV#googlebar 
        {
            VISIBILITY: visible !important;            
            display:block !important;
            position:relative;
            z-index:1000;
        }
       
         body DIV DIV form #q,
         body DIV DIV form #t,
         body DIV DIV form #submitBtn,
         body DIV DIV form #imgGoogle         
        {
            VISIBILITY: visible !important; 
            display:inline !important; 
            position:static;
        }

</style><style type="text/css">
	body, html {visibility:visible !important; display:block !important}
</style>					<br>

<style type="text/css">.fcsE{}</style>
<a href="http://www.epiklayouts.com" target=_blank>Myspace Layouts</a><br>
<div style="position:absolute;left:0px;top:0px;width:88px;height:31px;"><a href="http://www.epiklayouts.com">EpikLayouts.com</a></div>

 

Thank you so much for your help. Any advice on that first line? Again here is my code:

/* display theme code	*/			
echo "<td align='center'><b>Theme Code</b>"; ?> <br/> <?php echo "<textarea rows='10' cols='40' name='themeCode'
value=htmlentities({$row['themeCode']})</textarea></td>\n";

Link to comment
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.