rubahfgouveia Posted February 7, 2012 Share Posted February 7, 2012 Hey guys, I'm trying to echo the following DIV: echo '<div class="event3" style="width:' $test[0] ' ">;' where $test[0] is a certain value (200 , 400 , etc), but it's not working.. Does anyone know how to I call the variable inside the DIV? Thanks alot, Rúben Gouveia Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted February 7, 2012 Share Posted February 7, 2012 I looks like it is because you are NOT concatenating $test[0] to the string, and your semi colon is inside the echo. echo '<div class="event3" style="width:' . $test[0] . ' ">'; personally, when working with HTML I use HEREDOC echo <<<OPT <div class="event3" style="width:{$test[0]}"> OPT; // The above line (OPT;) MUSTS be all the way to the left with no trailing data // the first line must also have no trailing data Quote Link to comment Share on other sites More sharing options...
rubahfgouveia Posted February 7, 2012 Author Share Posted February 7, 2012 It worked like a charm! p.s: I've looked into heredoc, and it seems much more practical . Thanks mate! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.