# Display "chunks" of HTML code

**URL:** <https://forum.kirupa.com/t/display-chunks-of-html-code/302587>\
**Category:** programming\
**Created:** [January 4, 2010, 12:09am UTC](https://forum.kirupa.com/t/display-chunks-of-html-code/302587 "2010-01-04T00:09:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![IQAndreas](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@IQAndreas](https://forum.kirupa.com/u/IQAndreas)\
**Post date:** [January 4, 2010, 12:09am UTC](https://forum.kirupa.com/t/display-chunks-of-html-code/302587/1 "2010-01-04T00:09:34Z")

</div>

This is probably simple for someone more proficient in PHP.

Basically, I want to say “if (blabla), display this huge chunk of HTML” “else display this huge chunk”.

I could use a lot of echo statements, but that would be quite slow and inefficient (and TEDIOUS!).

I have seen something along the lines of this before, but I don’t remember which of the hundreds of files I have browsed or what the correct syntax is, but something like this:

```auto
<?php
$submitted = checkSubmitted();

if ($submitted)
{ ?>
   <h1>Form has been submitted! Thank you!</h1>
   <link>Go back</link>
<?php
}
else
{
?>
   <form>
       <input> 
       <...>
       <...>
   </form>
<?php
}
?>

```

If this is possible, it seems quite “unstructured”, however, for this purpose, I need anything that works right now.

I could also break up each part into individual php files which I bring in via “require\_once”, but that would make a lot of files and not worth my time.
