-1

I am a new learner software in PHP, so I try to do "button on click" in PHP with the object and I get the error message: " syntax error, unexpected '"'>"' (T_CONSTANT_ENCAPSED_STRING) "

this is my line of code:

$text .="<button onclick=alert"('" .$name. "\nIs Awesome!')"'>" . $name. "</button>";

Thank for help!

Elena
  • 11
  • 2

1 Answers1

0

$text .="<button onclick=alert('" .$name. "\nIs Awesome!')>" . $name. "</button>";

You had " bedore the opening ( which caused the error

Adam Hull
  • 214
  • 1
  • 8