How to create php echo output

This is probably a stupid question, but I can not find the answer. How to configure echo output using css? I have this code:

echo "<div id="errormsg"> Error </div>";

Now it displays a syntax error, I think because of these quotes around errormsg. I tried single quotes, but no effect. Thanks you

+5
source share
6 answers

to try

echo "<div id=\"errormsg\"> Error </div>";
+7
source

When outputting HTML, it is easier to use single quotes so that you can use the correct double quotes inside like this:

echo '<div id="errormsg"> Error </div>';

This will save you a parsing error ... To change the style, you will need to use CSS with a selector #errormsgas follows:

#errormsg {
    color: red;
}
+13
source

, :

echo "<div id='errormsg'> Error </div>";

, :

echo '<div id="errormsg"> Error </div>';

:

echo "<div id=\"errormsg\"> Error </div>";

CSS:

#errormsg {
    /* css */
}

, , , , PHP , .

+4

, "" , :

echo "<div id=\"errormsg\"> Error </div>";

.

echo "<div id='errormsg'> Error </div>";
echo '<div id="errormsg"> Error </div>';

PHP , , , .

+2

errormsg , , . , , .

echo "<div id='errormsg'> Error </div>";
+1

, , .

echo "<div id=\"errormsg\"> Error </div>";

echo '<div id="errormsg"> Error </div>';

, , echo - . HTML-, .

id:

#errormsg { /* … */ }

( ).

+1

All Articles