Prøv at initialisere variablen. Jeg har tilføjet hele koden. Du behøver ikke at hente $_POST['fil'].
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="root"; // Mysql password
$db_name="clinic"; // Database name
$tbl_name="patients"; // Table name
session_start();
$con=mysqli_connect("localhost","root","root","clinic");
$id=$_REQUEST['id'];
$name = '';
$remarcs = '';
$address = '';
$test_res = '';
$date = '';
$phone = '';
$new_path = '';
if (isset ($_POST['name'])) {
$name = $_POST['name'];
}
if (isset ($_POST['remarcs'])) {
$remarcs = $_POST['remarcs'];
}
if (isset ($_POST['test_res'])) {
$test_res = $_POST['test_res'];
}
if (isset ($_POST['address'])) {
$address = $_POST['address'];
}
if (isset ($_POST['date'])) {
$date = $_POST['date'];
}
if (isset ($_POST['phone_num'])) {
$phone = $_POST['phone_num'];
}
if(isset($_FILES['file'])){ //Check file is uploaded or not
$path = "../uploads/".$_FILES['file']['name'];
if(move_uploaded_file($_FILES["file"]["tmp_name"], $path)){
$new_path = $path;
$sql=" update patients set
name = '$name',
echo_photo = 'NULL',
echo_file = '$new_path',
remarcs = '$remarcs',
test_res = '$test_res',
date = '$date',
address = '$address',
phone_num = '$phone'
WHERE id = ".$id;
$result=mysqli_query($con,$sql) or die('Unable to execute query. '. mysqli_error($con));
if($result){
echo $name."<p>\n</p>";
echo $remarcs."<p>\n</p>";
echo $test_res."<p>\n</p>";
echo $address."<p>\n</p>";
echo $phone."<p>\n</p>";
}
echo "Uploaded";
} else {
echo "Not uploaded";
}
}
mysqli_close($con);
?>