View Full Version : Conditional for UL LI
KJThaDon
01-29-2012, 07:18 AM
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>
fastsol1
01-29-2012, 07:24 AM
You mean if $Features01 is not empty then echo the other li below it? If so that's fairly easy. Just do a if() and check if the $Features01 is empty.
<?php if (isset($_POST['Features01'])){echo "<div><h3>Features</h3><div><ul><li>$Features01</li>";}
if(!empty($Features01))
{
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>";}
}
?>
</ul>
</div>
</div>
KJThaDon
01-30-2012, 02:10 AM
You mean if $Features01 is not empty then echo the other li below it? If so that's fairly easy. Just do a if() and check if the $Features01 is empty.
<?php if (isset($_POST['Features01'])){echo "<div><h3>Features</h3><div><ul><li>$Features01</li>";}
if(!empty($Features01))
{
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>";}
}
?>
</ul>
</div>
</div>
Thank you! The only thing is, I need it to only show feature01 too if there is input. So if there is nothing in feature01 then the whole div and ul li should not be displayed
Thanks again im trying to figure it out
KJThaDon
01-30-2012, 02:25 AM
After further testing I see how this is working. I need it to only show features that have input entered. If there is nothing in 2-5 it still shows features01. Also if I have input in any of the 2-5 fields it shows all of them, just blank..
KJThaDon
01-30-2012, 02:30 AM
Here is the page that has the inputs if it would help you
http://lcdforvideo.com/josh/lcd4video.html
Thanks!
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.