php – How to Restrict Empty rows print in page-ThrowExceptions

Exception or error:

Code as been given

  • ;`

            <ul style="width:100%;font-family: calibri;font-size: 15px;">
                    <?php if ($com['Candidate_PG_Qualification'])!=""?>
                      <li><?php echo $com['Candidate_PG_Qualification']."         ".$com['Candidate_PG_Specialisation']." ".$com['Candidate_PG_University']." ".$com['Candidate_PG_YOP']; ?></li>;
                    <?php ?>
                    <li style="line-height: 1.6em; padding:10px;color:black;"><?php echo $com['Candidate_UG_Qualification']." ".$com['Candidate_UG_Specialisation']." ".$com['Candidate_UG_University']." ".$com['Candidate_UG_YOP']; ?></li>
                    <li style="line-height: 1.6em; padding:10px;color:black;"><?php echo $com['HSC_Board_of_Education']." ".$com['Candidate_HSC_YOP'];; ?></li>
                    <li style="line-height: 1.6em; padding:10px;color:black;"><?php echo $com['SSLC_Board_of_Education']." ".$com['Candidate_SSLC_YOP']; ?></li>
                    </ul>

    `

    How to solve:

    I don’t know what exactly you want but you have a code error.

    Here’s the fixed code:

    <ul style="width:100%;font-family: calibri;font-size: 15px;">
        <?php if (!empty($com['Candidate_PG_Qualification'])): ?>
            <li><?php echo $com['Candidate_PG_Qualification']."         ".$com['Candidate_PG_Specialisation']." ".$com['Candidate_PG_University']." ".$com['Candidate_PG_YOP']; ?></li>;
        <?php endif;?>
    
        <?php if (!empty($com['Candidate_UG_Qualification'])): ?>
            <li style="line-height: 1.6em; padding:10px;color:black;"><?php echo $com['Candidate_UG_Qualification']." ".$com['Candidate_UG_Specialisation']." ".$com['Candidate_UG_University']." ".$com['Candidate_UG_YOP']; ?></li>
        <?php endif;?>
    
        <?php if (!empty($com['HSC_Board_of_Education'])): ?>
            <li style="line-height: 1.6em; padding:10px;color:black;"><?php echo $com['HSC_Board_of_Education']." ".$com['Candidate_HSC_YOP']; ?></li>
        <?php endif;?>
    
        <?php if (!empty($com['SSLC_Board_of_Education'])): ?>
            <li style="line-height: 1.6em; padding:10px;color:black;"><?php echo $com['SSLC_Board_of_Education']." ".$com['Candidate_SSLC_YOP']; ?></li>
        <?php endif;?>
    </ul>
    

    Leave a Reply

    Your email address will not be published. Required fields are marked *