Sending DHT11 temperature Values to Server - Solved-

I would like some help to find a good method to send readings from a DHT11 to a webserver using Get. The standard example for Dht11 uses int chk = DHT11.read(DHT11PIN); to read the sensor and displays the result as a float withclient.print((float)DHT11.temperature, 0);. I would like to transfer the temperature readings as part of the Get request

sprintf(pageAdd,"/Tempdata.php?temp1=%d&humid1=%d",temp1,humid1);
     if(!getPage(server,serverPort,pageAdd)) Serial.print(F("Fail "));

I really don't know if I should convert the float to an integer or just send it as two values. For this sensor, I see no need for the decimal value anyways. Can someone suggest the best way to send the two or three digits of data.

as the DHT11 only returns an integer you can just send an integer.

On the receiving end you can still put it as float in a database or interpret it as a float or so.

EDIT: Please ignore the code below. It should have been obvious to me. Just change ’ float temp1 = dht.readTemperature();’ to 'int temp1= dht.readTemperature();

I saw that someone had referred to you as the guru of dht11. In spite of the time I have spent on this, I really don’t understand. Here are the pieces of code that I am using.

#include "DHT.h"
#define DHTPIN 37     // what pin we're connected to
#define DHTTYPE DHT11   // DHT 11  
DHT dht(DHTPIN, DHTTYPE);   
dht.begin(); 
 void loop()
{
    float level1 = dht.readHumidity();
    float temp1 = dht.readTemperature();
    if (isnan(temp1) || isnan(level1)) 
    
  
  {
        Serial.println("Failed to read from DHT");
    } 
  else
  {
        Serial.print("Humidity: "); 
        Serial.print(level1);
        Serial.print(" %\t");
        Serial.print("Temperature: "); 
        Serial.print(temp1);
        Serial.println(" *C");
    }
  
  
  {
    thisMillis = millis();
    if(thisMillis - lastMillis > delayMillis)
    lastMillis = thisMillis;

    // Modify next line to load different page
    // or pass values to server
    sprintf(pageAdd,"/Firstdata.php?temp1=%d&level1=%d",temp1,level1);

 
    if(!getPage(server,serverPort,pageAdd)) Serial.print(F("Fail "));
    else Serial.println(F("Pass "));

And the serial monitor shows

Starting ethernet...
ok
192.168.0.177
Ready
Humidity: 36.00 %	Temperature: 22.00 *C
connecting...connected
HTTP/1.1 200 OK
Date: Wed, 26 Feb 2014 21:45:33 GMT
Server: Apache
X-Powered-By: PHP/5.4.24
Vary: Accept-Encoding
Connection: close
Content-Type: text/html

<html><body>
test server page

<P>Insert ok</P>temp 1 = 0 Level 1 = 16816 </body>
</html>
disconnecting.
Pass

Although the values display correctly in the monitor, they aren’t passed to the php code correctly, and at this beginning stage of my education, I have no idea why?