suyash Posted May 22, 2013 Share Posted May 22, 2013 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 <html xmlns="http://www.w3.org/1999/xhtml"> <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 Quote Link to comment Share on other sites More sharing options...
suyash Posted May 22, 2013 Author Share Posted May 22, 2013 What can be the issue? I tried to change name, position of the text field and its name, but its not working, I have been unable to fetch data from this text field only. Quote Link to comment Share on other sites More sharing options...
suyash Posted May 22, 2013 Author Share Posted May 22, 2013 Undefined index: current_reading in C:\xampp\htdocs\test\billing.php on line 26 Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 22, 2013 Share Posted May 22, 2013 if($current_reading=" ") Is assignment. Quote Link to comment Share on other sites More sharing options...
suyash Posted May 22, 2013 Author Share Posted May 22, 2013 Thank you very much, its worked. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.