Click here to Skip to main content
16,019,018 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
PHP
<?php
		include '../forms/includes/connection.php';
		
		$sql = "SELECT FROM (booking_request) WHERE `booking_request_id`";
		$query = mysqli_query ($link,$sql);
		
		if (isset ($_POST['booking_request_id']))
	
	{	

		$id = $_POST['booking_request_id'];
		$sql = "DELETE from booking_requests where `booking_request_id` ='$id'";
		$query = mysqli_query ($link,$sql);
		
		
		if ($query)
	{
		header('location:whatsBooked.php');	
	}
	else
	{
		echo "Error: Record was not deleted" .mysql_error();
	}
	
	}
	
	else 
		
	echo " Function Error " .mysql_error();
?>


When the delete button is clicked Function Error, can anyone help me ?
Posted

1 solution

It is redirected to the last else which echo "Function error" because the
if (isset ($_POST['booking_request_id']))

is false.
That means there is no post element of 'book_request_id' submitted from the form, check if there is any typo in the name of the corresponding html element (I guess it is an input type = "text" element) on the submitting form.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900