Is there a better way to express this PHP code? I’ve received variables from a form and now need to check whether they are null or not before outputting a text string.
Many thanks in advance!
$Capacity = $_POST["Capacity"];
$Location = $_POST["Location"];
$RoomType = $_POST["RoomType"];
echo '<div id="container" style="padding: 15px; background-color: #949494;">';
echo '<div style="padding: 15px; background-color: #fff;">';
echo '<h2>Search results:</h2>';
echo '<h3>Showing';
if ($RoomType == '') echo ''; else echo ' '.$RoomType.' ';
echo ' rooms with a capacity of '. $Capacity .' and over';
if ($Location == '') echo ''; else echo ' in '.$Location.' Park';
echo '</h3>';
Edit 2: I revisited the code, so that it makes more sense.
Edit: Added
htmlentitiesfilter