Assign Javascript popup HTML link to PHP variable -



Assign Javascript popup HTML link to PHP variable -

i trying assign next php variable:

[<a href='"'javascript:pop_booking_item_add({id})'"'>add new item</a>]

i have tried this:

$add_button = "[<a href='"'javascript:pop_booking_item_add({id})'"'>add new item</a>]";

but getting error message:

error: syntax error, unexpected ''javascript:pop_booking_item_a' (t_constant_encapsed_string)

i think need escape quotes i'm not sure how to?

this should work:

$add_button = "[<a href='javascript:pop_booking_item_add({id})'>add new item</a>]";

or

$add_button = "[<a href=\"javascript:pop_booking_item_add({id})\">add new item</a>]";

javascript php html escaping variable-assignment

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -