unistake Posted September 4, 2009 Share Posted September 4, 2009 Hi all, Does anyone know how to send Javascript variables to a mysql database? If someone can give me an example that would be great. I am using PHP on the same page if that can be used also?... Thanks for the help Tim Link to comment https://forums.phpfreaks.com/topic/173134-how-to-send-js-variables-to-mysql/ Share on other sites More sharing options...
ldb358 Posted September 5, 2009 Share Posted September 5, 2009 i think your looking for is ajax Link to comment https://forums.phpfreaks.com/topic/173134-how-to-send-js-variables-to-mysql/#findComment-912943 Share on other sites More sharing options...
mrwutang Posted September 5, 2009 Share Posted September 5, 2009 Okay lemme see if I got this right, you want to pass your javascript values to php? Im kinda new to php so Ill tell you what I know. An easier way would be to use get method. For eg, if you want to pass the value of var variable='somethin' to php try. document.location='website.com/code.php?var='+variable; Or use an iframe or popup window to pass the value along.And set your php code to$_GET the variable. $varible=$_GET['var'];and use it to pass the value to mysql. Theres a more complex way to do this too, if you wanna use POST method.Using ajax. Lemme know if you wanna know that. Ill give you the code. I can tell you more if you tell me more about your code. What do you want to do with this variable? Link to comment https://forums.phpfreaks.com/topic/173134-how-to-send-js-variables-to-mysql/#findComment-912985 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.