If Die Else If: Mysqli
If Die Else If: Mysqli
php
$conn = new mysqli("localhost","root","","vehicle_details");
if($conn-> connect_error){
die("connection failed :". $conn -> connection_error);
}
else
if(isset($_POST['submit'])){
$name = $_POST['name'];
$mobile_no = $_POST['mnumber'];
$email = $_POST['email'];
$address = $_POST['address'];
$fuel_type = $_POST['fuel_type'];
$vehicle_number = $_POST['vnumber'];
$With_ac = $_POST['air'];
$Total = 0;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<style>
fieldset {background-color: blueviolet;
margin:auto;
width:50%;
border:3px solid;
padding:10px;}
body { background-color:skyblue;
alignmnet}
table { background-color:white;
font-color:pink;}
form input{background-color:yellow;}
form textarea{background-color:yellow;}
form select{background-color:yellow;}
</style>
<title>Form</title>
</head>
<body>
<fieldset ><legend> Vehicle Details</legend>
<form style="text-align:center" method="post" autocomplete="off"
action="" >
<br>
<br>
<br>
<!-- name-->
<!-- name-->
<br>
<br>
<br>
<!---Phone No.------>
<!---Phone No.---->
<br>
<br>
<br>
<!---Email ID---->
<!--Email ID----->
<br>
<br>
<br>
<!---Home Address------>
<!---Home Address------>
<br>
<br>
<br>
<!---Fuel Type------>
<!---Fuel Type------>
<br>
<br>
<br>
<!---Vehicle Number------>
<!---Vehicle Number------>
<br>
<br>
<br>
<!---Air Conditioning----->
Air Conditioning:
<input type="radio" name="air" value="yes" required> with
AC
<input type="radio" name="air" value="no" required> without
AC
<!---Air Conditioning--->
<br>
<br>
<br>
<!---Submit Button------>
<!---Submit Button----->
</fieldset>
</form>
<br>
<br>
<br>
<br>
<table border="1" >
<tr>
<th> Name </th>
<th> Mobile number </th>
<th> Email </th>
<th> Home address</th>
<th> Fuel type </th>
<th> Vehicle number </th>
<th> Air condition </th>
<th> Total </th>
</tr>
<?php $i = 1;
$rows = mysqli_query($conn,"SELECT * FROM vehicle_details ORDER BY
id DESC");
foreach($rows as $row): ?>
<tr>
<td><?php echo $row["Name"];?></td>
</tr>
<?php endforeach ; ?>
</table>
</body>
</html>