I am trying to create a website. I use Jquery and PHP for server-side and MySQL for database.Now thats one of my PHP files.
//header.php
<div class="d-flex justify-content-start flex-wrap">
<div id="today" class="gal1">today</div>
<div id="history" class="gal1 <?php echo empty( $user ) ? 'mr-auto' : ''; ?>" data-toggle="modal" data-target="#dateModal">history</div>
<?php
$stmt = $pdo->query("select isSeen from mail where isSeen = 0 and recipient = '$user'");
$lightUp = $stmt->rowCount() > 0 ? 'lightUp' : '';
if ( !empty( $user ) ) echo'<div id="me" class="gal1" onclick="location.href=\'http://localhost:180/anbu/someone.php?someone='.$user.'\'">@'.$user.'</div>
<div id="buddy" class="gal1" onclick="location.href=\'http://localhost:180/anbu/subs.php\'">buddy</div>
<div id="faves" class="gal1" onclick="location.href=\'http://localhost:180/anbu/faves.php\'">faves</div>
<div id="mbox" class="gal1 '.$lightUp.'" onclick="location.href=\'http://localhost:180/anbu/mbox.php\'">mBox</div>
<div id="options" class="gal1" onclick="location.href=\'http://localhost:180/anbu/options.php\'">options</div>
<div id="eight" class="mr-auto gal1" onclick=""><i class="fa fa-circle" style="color:blue;"></i></div>';
if ( empty( $user ) ) echo'<a class="gal2" href="http://localhost:180/anbu/log-in.php">log in</a>
<a class="gal2" href="http://localhost:180/anbu/sign-up.php">sign up</a>';
else
echo'<a class="gal2" href="http://localhost:180/anbu/userWorks/log-out.php">log out</a>';
?>
How to compress this code so my server won't have to send all the space characters? Is there a program for this kind of jobs? Yes, my first website and i am a newbie.