I am trying to grab a single variable from an array through my function open_boosters(), then send the variable to my PHP script. What is the correct way to do this?
All I have at the moment is this JavaScript function that generates random numbers, called open_boosters().
><img src="site3.php?"action="document.getElementById("?").innerHTML=open_boosters();"/>
In my PHP, should I simply bind the variable with a $_GET method?
It is best practice to move behaviors out of the HTML and into a
<script>tag, or better, an external script file (though with the ability to attach events to HTML elements). In this case, there is no reason to bind to an image element your code which has nothing to do with the image (it looks like it is trying to populate some other element).Then in your PHP code: