gamesmstr Posted November 18, 2008 Share Posted November 18, 2008 I am using a button with an onclick parameter to launch a AJAX JS function and passing some php variables, but I need help with the formatting. The 2 variables are $playerinfo[id] and $questrecord[uy]. <input type="button" value="North" onclick="playermove('north',playerinfo[id],questrecord[uy])"> Quote Link to comment https://forums.phpfreaks.com/topic/133197-passing-php-variables-to-ajax-script/ Share on other sites More sharing options...
xtopolis Posted November 19, 2008 Share Posted November 19, 2008 If you're saying php outputs that button.. then it would be: <?php echo "<input type='button' value='North' onclick=\"playermove('north','$playerinfo[id]','$questrecord[uy]')\" />"; ?> I think.. you might have to concat the php vars if it doesn't read the array indexes properly. Quote Link to comment https://forums.phpfreaks.com/topic/133197-passing-php-variables-to-ajax-script/#findComment-693159 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.