Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ABC_Air_Secure_Design/delete_flight_details_form_handler.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
74 lines (73 sloc)
1.61 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
?> | |
<html> | |
<head> | |
<title>Delete Flight Schedule Details</title> | |
</head> | |
<body> | |
<?php | |
if(isset($_POST['Delete'])) | |
{ | |
$data_missing=array(); | |
if(empty($_POST['flight_no'])) | |
{ | |
$data_missing[]='Flight No.'; | |
} | |
else | |
{ | |
$flight_no=trim($_POST['flight_no']); | |
} | |
if(empty($_POST['departure_date'])) | |
{ | |
$data_missing[]='Departure Date'; | |
} | |
else | |
{ | |
$departure_date=trim($_POST['departure_date']); | |
} | |
if(empty($data_missing)) | |
{ | |
require_once('Database Connection file/mysqli_connect.php'); | |
$query="DELETE FROM Flight_Details WHERE flight_no=? AND departure_date=?"; | |
$stmt=mysqli_prepare($dbc,$query); | |
mysqli_stmt_bind_param($stmt,"ss",$flight_no,$departure_date); | |
mysqli_stmt_execute($stmt); | |
$affected_rows=mysqli_stmt_affected_rows($stmt); | |
//echo $affected_rows."<br>"; | |
// mysqli_stmt_bind_result($stmt,$cnt); | |
// mysqli_stmt_fetch($stmt); | |
// echo $cnt; | |
mysqli_stmt_close($stmt); | |
mysqli_close($dbc); | |
/* | |
$response=@mysqli_query($dbc,$query); | |
*/ | |
if($affected_rows==1) | |
{ | |
echo "Successfully Deleted"; | |
header("location: delete_flight_details.php?msg=success"); | |
} | |
else | |
{ | |
echo "Submit Error"; | |
echo mysqli_error(); | |
header("location: delete_flight_details.php?msg=failed"); | |
} | |
} | |
else | |
{ | |
echo "The following data fields were empty! <br>"; | |
foreach($data_missing as $missing) | |
{ | |
echo $missing ."<br>"; | |
} | |
} | |
} | |
else | |
{ | |
echo "Delete request not received"; | |
} | |
?> | |
</body> | |
</html> |