I have to implement knapsack problem algorithm on my site that's based on PHP. I Thought that I will make it in JavaScript and I have ran into a problem. I'm taking data that I need to take into this algorithm from MySQL, and JavaScript just can't do this. So I managed to do this by adding connector from Node.js. The algorithm works when user is giving some input. I made an form in HTML just to grab input and use it as parameter in my function. The problem is now that whole website is wrote in PHP and I can't connect it with JavaScript, because of node.js part where I'm connecting to database. I want to ask if there is any way to use this.
To sum it up and make it clear: website is in PHP, I want to make a simple HTML form to grab input from user into parameter function from JavaScript file. Problem is that my JavaScript file needs MySQL data to run so it becomes node.js. And from what I know it's not that easy to run node.js on PHP based webserver. Is it possible to combine PHP with JavaScript so PHP will load data from MySQL into JavaScript? What you guys suggest?