Jump to content

Need some help with echo


jim.davidson

Recommended Posts

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

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";
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.