php grabbing data from javascript -


Apparently I try to save the data in mysql, but it does not work. ?

Create_users.php

& lt; Form method = "post" action = "check availability.php" & gt; & Lt; Script & gt; Var Mac = {getMacAddress: function () {document.macaddressapplet.SetSep ("-"); Return (document.macaddressapplet.getMacAddress ()); }} JQuery (document) .ready (function () {var mac = macs.getMacAddress (); $ .get ('/ checkAvailability.php? Mac =' + mac, function () {Alert ('yes'); })}); & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Document.write (macs.getMacAddress ()); & Lt; / Script & gt; & Lt; / Form & gt;

check availability # php

  $ dbhost = 'localhost'; $ Dbuser = 'root'; $ Dbname = 'Registration'; Mysql_connect ($ dbhost, $ dbuser) or die ("Could not connect to database"); Mysql_select_db ($ dbname); $ Mac = $ _GET ['Mac']; $ Mac = mysql_real_escape_string ($ MAC); $ Sql ​​= "Enter the value of the test (MAC) ('$ MAC')"; Mysql_query ($ sql);  

You can instead create your $ $ .get () method in "create_users.php" Calling you should call "check availability.php."

And try it for your customer side:

  var macs = {getMacAddress: function () {Document.macaddressapplet .setSep ("-"); Return (document.macaddressapplet.getMacAddress ()); }} JQuery (document) .ready (function () {var mac = macs.getMacAddress (); $ .get ('/ checkAvailability.php? Mac =' + mac, function () {Alert ('yes'); })});  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -