0

I am trying to make a conditional to only show the Div and contents inside the div/ul if the first input "Features01" has some input. Any help is appreciated! Thank you!

<?php if (isset($_POST['Features01'])){echo "<div><h3>Features</h3><div><ul><li>$Features01</li>";}?>
<?php if (isset($_POST['Features02'])){echo "<li>$Features02</li>";}?>
<?php if (isset($_POST['Features03'])){echo "<li>$Features03</li>";}?>
<?php if (isset($_POST['Features04'])){echo "<li>$Features04</li>";}?>
<?php if (isset($_POST['Features05'])){echo "<li>$Features05</li>";}?>
</ul>
</div>
</div>

Edited by KJThaDon: n/a

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by pritaeas
0

Put the rest of the conditions inside the first, like this:

if (isset($_POST['Features01']))
{
  echo "<div><h3>Features</h3><div><ul><li>$Features01</li>";
  if (isset($_POST['Features02'])) { echo "<li>$Features02</li>"; }
  if (isset($_POST['Features03'])) { echo "<li>$Features03</li>"; }
  if (isset($_POST['Features04'])) { echo "<li>$Features04</li>"; }
  if (isset($_POST['Features05'])) { echo "<li>$Features05</li>"; }
  echo '</ul></div></div>';
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.