POSTing from site to SIM900 module

Well I have successfully used the GPRS to uplift whatever I like and store it on my websites database whenever however I may like , but now I'm trying to mod the stuff and write some script etc to make the arduino receive stuff from my website , like say a button clicked , whenever I put php along with the scripting the php does not work, the code is as follows:

<!DOCTYPE html>
<html>
<head>
<script>
var state
function on()
{
  state = document.getElementById('but1').value;
  document.getElementById('field2').value = state;
}
function off()
{
 
  state = document.getElementById('but2').value;
  document.getElementById('field2').value = state;
}
</script>
</head>
<body>
	
Field2: <input type="text" id="field2" />



<input type='button' id="but1" onclick='on()' value='ON' />
<input type='button' id="but2" onclick='off()' value='OFF' />
<?php
             echo "hashar";
             if (state == "ON")
             {
               echo "on!";
             }
             if (state == "OFF")
             {
               echo "off!";
             }  
	?>

</body>
</html>

on the FIELD2: box shows and the two respective button also the scripting works but then nothing shows out of the php code.

Another point here is how I access the variables in scripting? I want to access the state variable

This is a PHP problem and has nothing to do with the Arduino! Ask in a PHP forum.

Hint anyway: PHP has no direct access to javascript variables, think about when and where PHP is executed, when and where javascript is executed.

Actually Now I have made some progress, I have used AJAX request to shoot HTTP get requests and that code is working flawlessly:

An excerpt from the code showing HOW the get data is sent to the script myform.php in a Silent way that is not opening any windows or showing in the link the script file running:

var namevalue=encodeURIComponent(document.getElementById("but2").value)
mygetrequest.open("GET", "myform.php?name="+namevalue, true)
mygetrequest.send(null)

At the other side the myform.php receives the values correctly you can see at http://winacro.com/scriptGET.php

So now I want to send the clicks to my SIM900 module running using ATmega328, previously I did the following request code and was successful in loading the values to a database on my server BUT THE MAIN QUESTION HERE IS HOW I CAN DO IT IN THE OTHER WAY AROUND that is now to send values from my site to Arduino:

 reading = analogRead(tempPin);
  tempC = reading / 9.31;
  mySerial.print("AT+HTTPPARA=\"URL\",\"http://winacro.com/script.php?tempC=");
  mySerial.print(tempC);
  mySerial.println("\"");
  delay(1000);
 
  ShowSerialData();
 
  mySerial.println("AT+HTTPACTION=1");//submit the request

I wanted to know I should I make the AT+HTTPPARA loaded as such I get the values from the clicks I make on that page.

EDIT: I further read into the SIM900 datasheet and what I read about is two commands that may work for me as follows:

  1. AT+HTTPREAD=<data_len>, , to be used when the AT+HTTPACTION=0 or AT+HTTPDATA is executed , so where should I execute it above httpaction and httpdata or below, I mean simply where should I write it?

OR

  1. AT+HTTPDATA=,,where in the code?

Hi,

Did you ever figure out how to get the data into your GSM module?