Flo SEBT Flo SEBT - 1 year ago 72
PHP Question

How to echo my HTML in PHP and get rid of an error message?

I'm trying to loop through an array and pass the values into HTML. My loop echos a large block of code. This is a small portion of the code I'm struggling with.

<p class='gl-item-title'>'.$array['title']'</p>
<p class='gl-item-category'>'.$array['type']'</p>

I get this error message

Parse error:

syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\MAMP\htdocs\simsestate\Sims-esate\index.php on line 223

I don't understand this error. Would somebody give tips on how to echo big chunks of HTML in PHP?

Answer Source
<p class='gl-item-title'>'.$array['title'].'</p>
<p class='gl-item-category'>'.$array['type'].'</p>

When you join strings you have to use dot, I don't know how rest of your code looks like but in this part you forgot dot after array index variable

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download