Skip to content Skip to sidebar Skip to footer

Setting A Cookie With Php Within Js Gives Me An Error On Line 29, Returning A Variable From Php Code?

I'm trying to experiment with getting and setting cookies with the PHP file below. I have a JavaScript function for checking to see (with is_set()) if the cookie exists; if so, get

Solution 1:

Replace

<?phpecho$HTTP_COOKIE_VARS["set_1"].?>;

with

<?phpecho$HTTP_COOKIE_VARS["set_1"];?>;
                                   //^----- Should be a semicolon !

Solution 2:

Why you are putting a dot(.) before ?>. Removing it will solve the issue.

SETTINGS[0] = <?phpecho$HTTP_COOKIE_VARS["set_1"]?>; 
SETTINGS[1] = <?phpecho$HTTP_COOKIE_VARS["set_2"]?>;

Post a Comment for "Setting A Cookie With Php Within Js Gives Me An Error On Line 29, Returning A Variable From Php Code?"