PHP和JavaScript数组附件

I have the following problem:

onclick=langedit('".$carray2['example']."','".$carray2['id']."')

$carray2['example'] is a string containing "ABOUT US" with space, and this is the output in HTML:

onclick='langedit('Contact" us','9')="">

My PHP code :

else {
$cquery2 = mysql_query ("SELECT id,example,".$startlan." FROM language WHERE example = '$word'");
$carray2 = mysql_fetch_array($cquery2);
if($carray2[$startlan] == '') {
if($_SESSION['view'] == 'admin' && isset($_SESSION['siteshow'])){
echo  "<span class='langedit' id='langedit".$carray2['id']."' onclick=langedit('".$carray2['example']."','".$carray2['id']."')><img src='images/sys/edit.png' > </span>";
return $carray2['example'];
}else{
return $carray2['example'];
}
}

I don't know what's happening, the langedit function does not work because of this.

Cover the langedit call on onclick with double quotes

onclick=\"langedit('".$carray2['example']."','".$carray2['id']."')\"

Otherwise if $carray2['example'] is About Us, the onclick attribute becomes onclick=langedit('About which is an invalid function call.