php - Unable to fetch data from textfield using $_POST -
i have been not able fetch data textfield 'current_reading'. can issue? every other text , $_post method working fine
index page
<body> <?php include "connect.php"; ?> <form method="post" action="billing.php"> <div id="wrapper"> <div class="data"> <div class="label"> society </div> <div class="textfield"> <input type="text" name="society" /> </div> <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 date </div> <div class="textfield"> <input type="text" name="previous_date" /> </div> <div class="label"> previous reading </div> <div class="textfield"> <input type="text" name="previous_reading" /> </div> <div class="label"> current date </div> <div class="textfield"> <input type="text" name="current_date" /> </div> <div class="label"> current reading </div> <div class="textfield"> ***<input type="text" name="current_reading" />*** </div> </div> <input type="submit" name="submit" value="submit" /> </div> </form> </body> </html> billing
<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 charges society=".$society); $amount = $units * $rate; $service_charge=mysql_query("select service_charge charges society=".$society); $net_bill=$amount+$service_charge; echo "the amount of net bill is:".$net_bill; mysql_query("insert report values ('$id', '$current_date', '$net_bill','$units')"); } ?> <?php include "connect.php"; ?> </body> </html> i have been not able fetch data textfield 'current reading'(bold , red). can issue? every other text , $_post method working fine
change line code in billing.php
if($current_reading=" ") { echo "current date:".$current_date."<br><br>"; } become
if(empty($current_reading)) { echo "current date:".$current_date."<br><br>"; } hopefully works.
Comments
Post a Comment