Jump to content

formatting html within php code


asuh

Recommended Posts

Here's the scenario:

 

I have a site that uses some form code in the shopping cart. I have different customers coming through and the forms for each customer are customized. So, when a customer from X uses the shopping cart, he'll see a difference from customer from Y.

 

Here's basically what it looks like:

 

<?php
if ( var == "X")
{ echo "<custom html code>";}
elseif ( var == "Y")
{ echo "<custom html code>";}
?>

 

What I'd like to do, however, is be able for the code to look like it should within the "View Source" of any regular html page. If I include custom code inside an else, there's no way for me to have the proper tab and spacing, is there?  If you need more examples, please let me know and I'll try to be even more specific.

Link to comment
https://forums.phpfreaks.com/topic/107716-formatting-html-within-php-code/
Share on other sites

So, if I was to use source formatting on a form within the echo statement, how would i format this so that i use proper syntax?

 

For example:

 

<form method='post' action='sony_ok.php'>\n
\t<fieldset>\n
	\t\t<ol>\n
		\t\t<li>\n
			\t\t\t\t<input type='hidden' name='mode' value='sonycust'>\n
			\t\t\t\t<input type='hidden' name='item' value='$item'>\n
			\t\t\t\t<input type='hidden' name='attnfrst' value='$Sattnfrst'>\n
			\t\t\t\t<input type='hidden' name='attnlast' value='$Sattnlast'>\n

 

I'd like to be able to properly use double quotes in the <form> and <input> field. Is there not a better, easier way to do this?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.