PHP and Javascript interact
PHP and Javascript cannot directly interact since PHP is a server side language and Javascript is a client-side language.
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Afzaal Ahmad ZeeshanRank #60 · 27.6K reputationPosted Jul 29, 2019, 9:29 AM EDT
Exactly, you are right, but you can still inject the values from the PHP code before your JavaScript gets sent to the browser. And this is only possible for the inline JavaScript, not for the loaded scripts.
Md SarfarajRank #194 · 12.4K reputationPosted Jul 29, 2019, 7:18 PM EDT
Junaid ShahidRank #436 · 5.7K reputationPosted Jul 29, 2019, 11:07 PM EDT