<div class="interactionLinksDiv">
<a href="javascript:toggleReplyBox('.$fullname.','.$current_id.','.$current_id.','.$id.','.$thisRandNum.')">REPLY</a>
</div>
I have call the javascript function toggleReplyBox with five parameters. This code is written inside the php tags. But this code is not executing properly and the parameters are not being passed properly. If I call the function toggleReplyBox here with no parameters it works fine but thats not what I want.
<div class="interactionLinksDiv">
<a href="javascript:toggleReplyBox('<?php echo $fullname; ?>','<?php echo $current_id; ?>','<?php echo $current_id ; ?>','<?php echo $id; ?>','<?php echo $thisRandNum; ?>')">REPLY</a>
</div>
When I copied this code to the html part of my php file It works fine and the parameters are passed and the function executes properly. But I want to know why the function is not able to work inside of the php tags when everything is the same.
function toggleReplyBox(sendername,senderid,recName,recID,replyWipit) {
$("#recipientShow").text(recName);
document.replyForm.pm_sender_name.value = sendername;
document.replyForm.pmWipit.value = replyWipit;
document.replyForm.pm_sender_id.value = senderid;
document.replyForm.pm_rec_name.value = recName;
document.replyForm.pm_rec_id.value = recID;
document.replyForm.replyBtn.value = "Send";
if ($('#replyBox').is(":hidden")) {
$('#replyBox').fadeIn(1000);
} else {
$('#replyBox').hide();
}
}
Inside the php tags I changed the code :
print <<<HTML
<div class="interactionLinksDiv">
<a href="javascript:toggleReplyBox('$fullname','$current_id','$current_id','$id','$thisRandNum')">REPLY</a>
</div>
HTML;
And it is still showing the error Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\Fluid Solution\fluid-solution-website-template\interact\profile1.php on line 130
Line 130 is the <a href... line.