Staggan Posted January 22, 2013 Share Posted January 22, 2013 (edited) Hello I am after some help... I am trying to pass a number of php variables to javascript variables and it is not working, instead javascript is assigning the php query to those variables... This is my code: <script type="text/javascript"> var snsUserid = "<?=$snsUID?>" ; var sns = 'Game'; var snsUsername = "<?=$snsUsername?>"; var snsAffiliateid = 1; var userLang = "<?=$userLang?>"; </script> OR <script type="text/javascript"> var snsUserid = "<? echo $snsUID; ?>" ; var sns = 'Game'; var snsUsername = "<? echo $snsUsername; ?>"; var snsAffiliateid = 1; var userLang = "<? echo $userLang; ?>"; </script> Basically the code assigns the whole string to the var rather than the php variable value Neither works Any ideas ? Thanks Edited January 22, 2013 by Staggan Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 22, 2013 Share Posted January 22, 2013 Try using full tags, not short tags. If that doesn't fix it, show us the actual output. Quote Link to comment Share on other sites More sharing options...
Staggan Posted January 22, 2013 Author Share Posted January 22, 2013 Thanks Solved now, php on the server this was running off was not setup right, so I am told, and now it works... Thanks for the help though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.