Jump to content

Unable to fetch data from textfield


suyash

Recommended Posts

Hello

 

I have two files

<html>

 

<body>
 
<?php
include "connect.php";
?>
<form method="post" action="billing.php">
 
<div id="wrapper">
<div class="data">
  
    
    <div class="label">
        Customer id
        </div>
        <div class="textfield">
        <input type="text" name="customer_id"  />
        </div>
        
        <div class="label">
        Customer name
        </div>
        <div class="textfield">
        <input type="text" name="customer_name"  />
        </div>
        
        <div class="label">
        Wing
        </div>
        <div class="textfield">
        <input type="text" name="wing"  />
        </div>
        
        <div class="label">
        Flat no
        </div>
        <div class="textfield">
        <input type="text" name="flat_no"  />
        </div>
        
        <div class="label">
        Previous reading
        </div>
        <div class="textfield">
        <input type="text" name="previous_reading"  />
        </div>
        
        <div class="label">
        Previous date
        </div>
        <div class="textfield">
        <input type="text" name="previous_date"  />
        </div>
        
        <div class="label">
        Current reading
        </div>
        <div class="textfield">
        <input type="text" name="current_reading"  />       
        </div>
        
        <div class="label">
        Current date
        </div>
        <div class="textfield">
        <input type="text" name="current_date"  />
        </div>
 
    </div>
    
    <input type="submit" name="submit" value="submit"  />
</div>
</form>
 
</body>
</html>
 
and second file
 
 
<body>
<?php
include "connect.php";
?>
 
<?php
 
$society=$_POST['society'];
$id=$_POST['customer_id'];
$name=$_POST['customer_name'];
 
$wing=$_POST['wing'];
$flat_no=$_POST['flat_no'];
 
$previous_reading=$_POST['previous_reading'];
$previous_date=$_POST['previous_date'];
 
$current_date=$_POST['current_date'];
$current_reading=$_POST['current_reading'];
 
if($current_reading=" ")
{
echo "current date:".$current_date."<br><br>";
}
 
else
{
echo "current reading:".$current_reading."<br><br>";
echo "previous reading:".$previous_reading."<br><br>";
 
$units=($current_reading-$previous_reading);
echo "units".$units."<br><Br>";
 
$rate= mysql_query("select per_unit_rate from charges where society=".$society);
 
$amount = $units * $rate;
 
$service_charge=mysql_query("select service_charge from charges where society=".$society);
 
$net_bill=$amount+$service_charge;
 
echo "The amount of net bill is:".$net_bill;
 
mysql_query("insert into report values ('$id', '$current_date', '$net_bill','$units')");
}
?>
 
<?php
include "connect.php";
?>
 
</body>
</html>

 

 

I have been not able to fetch data from the textfield 'current reading'(bold and red). What can be the issue? every other text and $_POST method are working fine

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.