-4

Im trying to get dynamic with php. And I wonder if this is possible. However i pass a $var to ID the section does not show up. Lets say I have this:

<?php
$var = "welcome";

$html = '<section id="'.$var.'">Im glad you are here</section>';

echo $html;
?>

So this is the basic thing and I cant find any other reference to this. Note: Im writing this from my phone so forgive me if there is a syntax error. Thanks in advance and wish you a good day.

corpo
  • 13
  • 3

1 Answers1

0

Well the first thing I see is there is a mismatch between your variable name and the variable you pass.

Variable decaration is as V then you pass var

thefolenangel
  • 972
  • 9
  • 29
  • Although there will be an `undefined` error, `
    ` should still appear
    – Carl Binalla Jul 19 '17 at 06:52
  • Section is appear. At least on my end when I test the code `
    Im glad you are here
    `
    – S.I. Jul 19 '17 at 06:53
  • Well thanks for your answers guys, I think I need to post my script but now Im away. I will post it later. thank you all, Ill come back soon. – corpo Jul 19 '17 at 07:14