I have a form that posts (a,b) values into the following .php file, and displays an error message when the user tries to reach the .php file directly, instead via POST request.This code is probably pretty messy, for example, I'm not sure I can post <p> tags right away, instead of having them inside the <html> tags, but since it's an if/else function, I'm not sure how to build this in the most efficient way.<?php    if ($_SERVER['REQUEST_METHOD'] !== 'POST') {?>    <p>You didn't come here through a Post.</p><?php    } else {if(isset($_POST['a'])){    switch ($_POST['a']) {    case 1:        $var1 = word1;        break;    case 2:        $var1 = word2;        break;    default:        $var1 = other;    }}if(isset($_POST['b'])){    switch ($_POST['b']) {    case 1:        $var2 = word3;        break;    case 2:        $var2 = word4;        break;    default:        $var2 = other;    }}?>  <!doctype html><html><head><title>test</title><meta http-equiv=Content-Type content=text/html; charset=utf-8><style>#various-styles {}</style></head><body><div>HTML-blocks that contain PHP such as <?php echo $var1; ?>, and <?php echo $var2; ?>.</div></body></html><?php    }?>
If/else that contains HTML blocks, which contain additional PHP functions
php