Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax Error in concat echo statement and html code

Please help me to understand syntax of concat following

i want following code inside echo to understand concate

1--> <div class="alert echo $_REQUEST['error_id'];?>"\>

I try following code but getting syntax error that there is two echo..

2--> echo "<div class=\"alert" . echo $_REQUEST['error_id']; . "\">";

where mistake is that i cant get it... and i want two answer both using single quote and double quote

EDIT

Thank @Rizier123 now it working but css is not working as i have apply in calss="alert"

while using following code its working fine <div class="alert echo $_REQUEST['error_id'];?>"\>

enter image description here

But after applying your code its not working..only text appear but background color is not comming nad boarder is also dissappear as below

enter image description here

class name is alert shows the status of login..

EDIT

Thanks again i just forget to put space after class name..

like image 329
Vishnu S. Divetia Avatar asked Dec 15 '25 06:12

Vishnu S. Divetia


1 Answers

You don't need to write echo and ; again!

So this should work:

//echo with double quotes
echo "<div class=\"alert" . $_REQUEST['error_id'] . "\">";        

//echo with single quotes
echo '<div class="alert' . $_REQUEST['error_id'] . '">';       

Maybe you need to add a space if your class name includes spaces!(..."alert "...)

like image 196
Rizier123 Avatar answered Dec 16 '25 21:12

Rizier123



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!