Undefined Index error

Can you please help me what’s wrong with my code? I already fixed this before but I don’t know why I keep having this error again:


This is my source code:

$host = "localhost";//serverhost
$username = "----";
$password = "----";
$dbname = "----";// database name

$Tk_SchTime = $_POST['Tk_Time'];
$Tk_SchBranch = $_POST['Tk_Branch'];

$conn = new mysqli($host,$username,$password,$dbname);
$data = mysqli_query($conn, "SELECT * FROM bus WHERE Bus_Dep_Time='$Tk_SchTime' AND Bus_Branch='$Tk_SchBranch'");

while ($result=mysqli_fetch_array($data))
{
    echo "<strong>Plate Number</strong> | ";
	echo $result["Bus_Plate_Number"];
	echo "<br>";
	echo "<strong>Class</strong> | ";
	echo $result["Bus_Class"];
	echo "<br>";
	echo "<strong>Departure Time</strong> | ";
	echo $result["Bus_Dep_Time"];
	echo "<br>";
	echo "<strong>Arrival Time</strong> | ";
	echo $result["Bus_Arriv_Time"];
	echo "<br>";
	echo "<strong>Driver</strong> | ";
	echo $result["Bus_Driver "];
	echo "||";
}

and this is my blocks:

Thanks in advance

GET And POST blocks ?

Method Get —> $_Get …
:point_down::thinking:

Method Post —> $_Post …
:point_down::+1:

Try this

1 Like