Hi My uploadform page is not redirecting to the thank-you.php page after upload. Everything is perfect i dont want to change the code, its just that the header is not directing the paege to go to thank-you.php.
Here is the code that posts the data.
<?php
$target = "Carpics";
//$target = $target . basename( $_FILES['photo']['name']);
ini_set('display_errors',1);
error_reporting(0);
$conn = mysql_connect("localhost","admin","");
if(!$conn)
{
echo mysql_error();
}
$db = mysql_select_db("upload",$conn);
if($db)
{ echo mysql_error();
}
$name = $_POST['name'];
$address = $_POST['address'];
$from_date = $_POST['from_date'];
$to_date = $_POST['to_date'];
$full_name = $_POST['full_name'];
$email = $_POST['email'];
$city = $_POST['city'];
$tel = $_POST['tel'];
$town = $_POST['town'];
$country = $_POST['country'];
$model = $_POST['model'];
$displacement = $_POST['displacement'];
$trans = $_POST['trans'];
$driver = $_POST['driver'];
$photopath1 = $target . basename( $_FILES['photo1']['name']);
$photopath2 = $target . basename( $_FILES['photo2']['name']);
$photopath3 = $target . basename( $_FILES['photo3']['name']);
$photopath4 = $target . basename( $_FILES['photo4']['name']);
for($i=1;$i<5;$i++){
if($i==1){
$target = $photopath1;
}elseif($i==2){
$target = $photopath2;
}elseif($i==3){
$target = $photopath3;
}elseif($i==4){
$target = $photopath4;
}
$photo = addslashes(file_get_contents($_FILES['photo'.$i]['tmp_name']));
$image = getimagesize($_FILES['photo'.$i]['tmp_name']);
$imgtype = $image['mime'];
if(move_uploaded_file($_FILES['photo'.$i]['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['photo'.$i]['name']);
}
else {
echo "Sorry, there was a problem uploading your file.";
}
}
if(!$insert = mysql_query("INSERT INTO data VALUES('','$name','$address','$from_date','$to_date','$full_name','$email','$city','$tel','$town','$country','$model','$displacement','$trans','$driver','$photo', '$photopath1', '$photopath2', '$photopath3', '$photopath4','$imgtype')"));
echo header('Location: thank-you.php');
?>
it instead displays this The file img5.jpgThe file img7.jpgThe file Pontiac sports car.jpgThe file volkswagen-polo.jpg
Help please