Display "chunks" of HTML code

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:

<?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.