user2826169
user2826169

Reputation: 285

how to put single double quotes together?

I have the following php code.

$msg .='<a href="#dialog" name="modal" class="icons reply_icon" onclick="reply('.$messages_row["sender_id"].','.$messages_row['sender_email'].')"><span>reply</span></a>';

When I click this anchor tag, I get the following error in console.

SyntaxError: illegal character @ in [email protected]

I know the problem is due to single double quotes but don't know how to put the correct quotes.Can anyone help me please.

Upvotes: 0

Views: 91

Answers (2)

user2768948
user2768948

Reputation:

You can use backslash to use quotes as part of string
And in javascript, when passing str data to function it need to be in quotes.

 $msg .='<a href="#dialog" name="modal" class="icons reply_icon" onclick="reply(\''.$messages_row["sender_id"].'\',\''.$messages_row['sender_email'].'\')"><span>reply</span></a>';

Upvotes: 6

03Usr
03Usr

Reputation: 3435

You can escape them with: &quot;

Upvotes: 0

Related Questions