GIF89a
<?php
include_once('db.php');
session_start();
if(isset($_POST['submit']))
{
$id=$_POST['id'];
$namez=$_POST['name'];
$name=str_replace("'","\'",$namez);
$name1z=$_POST['name1'];
$name1=str_replace("'","\'",$name1z);
if(!empty($_FILES['file1']['name']))
{
$fileName1=$_FILES["file1"]["name"];
move_uploaded_file($_FILES["file1"]["tmp_name"],"image/Speciality/".$_FILES["file1"]["name"]);
}
else
{
$fileName1 = $_POST["file2"];
}
$insert = $db->query("update p7 set name='$name',name1='$name1',file1='$fileName1' where id='$id'");
if($insert){
header("location:Speciality-view.php");exit;
}else{
echo "File upload failed, please try again.";
}
header("location:Speciality-view.php");exit;
}
?>