I have just written this code o update my MYSQL Server with data from an Arduino Micro controller using Ethernet.

Basically I want to pass the variables collected by the Arduino to the Server.

Whenever I try to use this script the Values $_POST & $_POST do not get passed on!

$NAME = $_POST['Name'];
$DATA = $_POST['Value'];

$con = mysql_connect("localhost","root","rawraw");
if (!$con)
  die('Could not connect: ' . mysql_error());

mysql_select_db("sensor-data", $con);

$sql = "INSERT INTO `sensor-data`.`Data_Log` (`Key`, `Date`, `Time`, `Sensor_Name`, `SensorValue`) VALUES (NULL,CURDATE(),CURTIME(),'$NAME','$DATA')";

if (!mysql_query($sql,$con))
  die('Error: ' . mysql_error());
echo "1 record added";


Cant figure out what I have done wrong!
Can anyone help?

Thanks in Advance

You should be using the $_GET superglobal when trying to retrieve values from the url.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.