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])"> 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. 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
Archived
This topic is now archived and is closed to further replies.