Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

This question already has an answer here:

I have a javascript function. It has a variable that takes a particular value (entered by user). I need to insert this value in an sql database. I know I cannot use javascript to connect to database, I need to use php for that. Can you tell me how to do that? Just explain, I will write the code. I mean, do i need to create a new php file (but then if i create a new php sheet,then how can i access this variable bcz its in an all together different php sheet) or can I write in the same file, stuff like this....

share|improve this question
add comment

marked as duplicate by Marcin Orlowski, dnagirl, null, Quentin, Jocelyn Apr 11 '13 at 2:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

Sounds to me like you need an AJAX call to a separate PHP file to process the script and return the values to the JavaScript.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.