Hi. Welcome to Bytes!.
The problem there is that you are opening and closing the string in random places while you try to build it...
You can't use a single-quote mark inside a single-quote mark enclosed string, obviously.
For example, this is a simplifyed version of what you are doing:
-
$str = 'Your name is '$yourname'.';
-
You can see why that would be a problem right?
The single-quote mark meant to be inside the string is in fact closing the string, at which point the $yourname variable is out of place, causing the parse error.
Instead, try to either enclose the string in double-quote marks or escape the additional single-quotes.
Like:
-
$str = "Your name is '$yourname'";
-
$str = 'Your name is \''. $yourname .'\'';
-
Note, that because the second example there is enclosed in single-quote marks, I can not use variable names directly in the string. I had to end the string and add it using a dot.
Also note that when adding array elements directly into a string, it is advisable to use curly-braces.
Like:
-
$str = "Your name is {$_POST['Username']}";
-