0byt3m1n1
Path:
C:
/
Users
/
Administrator
/
Desktop
/
shafna
/
rainfall
/
[
Home
]
File: result.php
<?php include("config.php"); $length=$_POST['fname']; $width=$_POST['lname']; $district=$_POST['state']; $block=$_POST['district']; $last_id=$con->insert_id; $sql = "SELECT DistCode FROM district WHERE DistrictName = '$block'"; $result = mysqli_query($con, $sql ); if( $result ) { while( $row = mysqli_fetch_assoc( $result ) ) { $id=$row['DistCode']; } //echo $id; } else{ echo "Somethimg went wrong please check"; // failure! check for errors and do something else } $rainsql = "SELECT AvgRain FROM rainfalldata WHERE DistCode = '$id'"; $rainresult = mysqli_query($con, $rainsql ); if( $rainresult ) { while( $row = mysqli_fetch_assoc( $rainresult ) ) { $rainAvg=$row['AvgRain']; } //~~echo $rainAvg; } else{ echo "Somethimg went wrong please check"; // failure! check for errors and do something else } $roof=$_POST['type']; //echo $roof; if ($roof == 'Fibre sheet') { $rc= 0.9; } elseif($roof == 'Tile') { $rc= 0.8; } elseif($roof == 'Asbestos') { $rc= 0.8; } else { $rc= 0.2; } //echo $rc; $result = $rc*$length*$width*$rainAvg*1000; ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta charset="utf-8"> <title>Rainfall Calculator</title> <meta name="generator" content="Bootply" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous"> <link rel="stylesheet" href="resultstyle.css"> <script> </script> </head> <body> <div class="col-sm-8"> <div class="row"> <div class="col-xs-12"> <!--<form name="insert" action="" method="post">--> <form action="result.php" method="POST"> <div class="banner"> <h1>ROOF TOP RUN-OFF VOLUME CALCULATOR</h1> </div> <div class="colums"> <div class="item"> <label for="name"> Length of roof top <span></span></label> <input id="result" type="result" name="name" value= "<?php echo $length;?> meter " readonly/> </div> <div class="item"> <label for="name"> Width of roof top <span></span></label> <input id="result" type="result" name="name" value= "<?php echo $width;?> meter " readonly/> </div> <div class="item"> <label for="name"> Selected Roof Type<span></span></label> <input id="result" type="result" name="name" value= "<?php echo $roof;?> " readonly/> </div> <div class="item"> <label for="name"> Estimated rainfall in selected place<span></span></label> <input id="result" type="result" name="name" value= "<?php echo $rainAvg;?> " readonly/> </div> </div> </br></br> <div class="res"> <label for="name"><h2> Total Volume of Rainfall over the roof</h2><span></span></label> <input id="result" type="result" name="name" value= "<?php echo $result;?> cubic litre " readonly/> </div> <div class="btn-block"> <button type="button" name="logout" id="logout" onclick="window.location.href ='index.php'">close</button> </div> </form> </div> </div> </div> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> </body> </html>