GIF89a
<?php
// Include the database configuration file
include 'db.php';
$statusMsg = '';
// File upload path
//$targetDir = "uploads/";
//$fileName = basename($_FILES["file"]["name"]);
//$targetFilePath = $targetDir . $fileName;
//$fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION);
if(isset($_POST["submit"])){
// Allow certain file formats
$namez=$_POST['name'];
$name=str_replace("'","\'",$namez);
//$allowTypes = array('jpg','png','jpeg','gif','pdf','docx','doc');
//if(in_array($fileType, $allowTypes)){
// Upload file to server
// if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){
// Insert image file name into database
$insert = $db->query("INSERT into p2 (name) VALUES ('".$name."')");
if($insert){
$redirectUrl = 'Gallery-Title.php';
echo '<script type="application/javascript">alert("Registered"); window.location.href = "'.$redirectUrl.'";</script>';
}else{
$statusMsg = "File upload failed, please try again.";
}
}
// Display status message
echo $statusMsg;
?>