hya im following a tutorial through a video and im having issues in the following line its showing a error in my editor

$pm_ui .= '<button id="pmBtn" onclick="postPm(''.$u.'',''.$log_username.'','pmsubject','pmtext')">Send</button>';

see full code below including this line if anyone can help be much appreciated

// Protect this script from direct url access 
// You may further enhance this protection by checking for certain sessions and other means 
if ((!isset($isFriend)) || (!isset($isOwner))){ 
// Initialize our ui 
    $pm_ui = ""; 
// If visitor to profile is a friend and is not the owner can send you a pm 
// Build ui carry the profile id, vistor name, pm subject and comment to js 
if($isFriend == true && $isOwner == "no"){ 
    $pm_ui = "<hr>"; 
    $pm_ui .= '<input id="pmsubject" onkeyup="statusMax(this,30)" placeholder="Subject of pm..."><br />'; 
    $pm_ui .= '<textarea id="pmtext" onkeyup="statusMax(this,250)" placeholder="Send '.$u.' a private message">


The problem is caused by the quotes, you need to escape them correctly, try:

$pm_ui = '<button id="pmBtn" onclick="postPm(\''.$u.'\',\''.$log_username.'\',\'pmsubject\',\'pmtext\')">Send</button>';

In your case you're including PHP variables and your using single quotes, so you have to escape those to create the javascript arguments, and make the variables print their values. Here are few valid possible combinations:

$z = 'red';

$a = '<b class=\''.$z.'\'>Hi</b>';
$b = '<b class="'.$z.'">Hi</b>';
$c = "<b class='$z'>Hi</b>";
$d = "<b class=\"$z\">Hi</b>";

Check the docs for more information: https://php.net/language.types.string