如果是其他PHP语句,其中包含href和li中的变量

enter image description hereI have URLs in the database being called by either with $p_camping or $p_hiking

if they're empty, they echo nothing, if the table contains a url for hiking/camping, it will echo a url in an li.

It properly shows empty if the table cell is empty, but it will not echo the href in an li properly, it just spits out the full html link without an li or line break

I've tried countless ways of writing the echos but nothing seems to work, below are two i've tried

<!-- HTML -->

 <ul>
    <? echo "$p_camping" ?>
    <? echo "$p_hiking" ?>
 </ul>
 
 
 <!-- PHP INCLUDE with two variations i've tried out of many -->
 
 $row = mysqli_fetch_array($result);
  $p_camping = $row['p_camping'];
  $p_hiking = $row['p_hiking'];
    
  
 else
{
  echo "<li><a href='".$p_camping."'>Camping Info</a></li>";  
}


if(empty($row['$p_hiking']))
{
    // it's empty!
    echo " ";
}
else
{
  echo "<li><a href=\"$p_hiking\">Hiking Info</a></li>";  
}

</div>

Simple use !empty()

<?php

echo "<ul>";

if(!empty($p_hiking))
{
    echo "<li><a href='$p_hiking'>Hiking Info</a></li>";  
}

if(!empty($p_camping))
{
    echo "<li><a href='$p_camping'>Camping Info</a></li>";  
}

echo "</ul>";

?>

You shuld write li tag inside ul try like this

<?php
    $url = $p_camping ? $p_camping : ($p_hiking ? $p_hiking : "");
?>
<ul>
    <?php
        if($url){
            echo "<li>$url</li>";
        }
    ?>
</ul>

Please first check whether p_camping is empty or not

 if(!empty($row['p_camping']))
 {
    echo "<li><a href='".$p_camping."'>Camping Info</a></li>";
 }