jim.davidson Posted April 11, 2007 Share Posted April 11, 2007 I'm running php 5.o mySQL 4.1.21 and dreamweaver8 What I want to do is simple (I think), I have an array and I want to list the contents centered on the page. if ($error) { echo '<ul>'; foreach ($error as $alert) { echo "<li class='warning'>$alert</li>\n"; } echo '</ul>'; How do I get it centered? Link to comment https://forums.phpfreaks.com/topic/46604-need-some-help-with-echo/ Share on other sites More sharing options...
Lumio Posted April 11, 2007 Share Posted April 11, 2007 that has nothing to do with php. <center> <ul> <li>list</li> </ul> </center> Link to comment https://forums.phpfreaks.com/topic/46604-need-some-help-with-echo/#findComment-226849 Share on other sites More sharing options...
soycharliente Posted April 11, 2007 Share Posted April 11, 2007 I don't know that you can center a list item. I'm sure you could use CSS to try though. Alternatively, you could echo out each one without using a list and just use <div> and < br /> tags. if ($error) { echo "<div align=\"center\">\n"; foreach ($error as $alert) { echo $alert . "<br />\n"; } echo "</div>\n"; } Link to comment https://forums.phpfreaks.com/topic/46604-need-some-help-with-echo/#findComment-226852 Share on other sites More sharing options...
jim.davidson Posted April 11, 2007 Author Share Posted April 11, 2007 I knew it was simple, I'm just dumb. The first answer (use center stupid) worked fine. I learning gimme a break Thanks all Link to comment https://forums.phpfreaks.com/topic/46604-need-some-help-with-echo/#findComment-226867 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.