Okay, analyzing your code...
So, once your form is submitted...
You go through some error checking...for which the code is not making much sense to me.
if (!empty($_POST['type'])) {
$t = escape_data($_POST['type']);
$message .= '<p>You forgot to enter the property type!</p>';
} else {
$t = '';
}
If you get a value for 'type', then set $t to the value and then print a message that says you didn't fill it in??? If you don't have a value, then $t is nothing???
Why not do it this way:
if (strlen($_POST['type'])) {
$t = escape_data($_POST['type']);
} else {
$message .= '<p>You forgot to enter the property type!</p>';
}
So, that would say, if you have a value for 'type' then set $t to that value....otherwise, append an error to the $message var.
Okay, after you check for the errors...
You'll probably want to put an if statement around your sql query so that it doesn't occur if there were errors:
if (empty($message)){
$query = "INSERT INTO woodman (type, location, price, ref, high_lights, status, pics_thumburl, pdf, registration_date) VALUES ('$t', '$l', '$p', '$r', '$h', '$s', '$pics_thumburl', '$pdf', NOW())";
$result = @mysql_query ($query);
}
Next...You have your file operations. That all looks fine...basically.
What confuses me about all this is that you've got the header() there with only one condition on it. If the form is submitted, go to http://www.mysite.co.uk/woodman_confirm_detail.php. So, none of the error checking, confirm and failure messages matter at all. They're set and ready to go, but right before they're displayed to the user, the page changes. They'll never know if their operation worked or not.
Where is $message printed?
You should do the same type thing as $message with all the echos you've written for the file operations. Maybe even append those to the $message var. That way you can leave your header() where it is because you won't be echoing anything.
The only case you'd need to echo something is in the event of an error. If everything goes fine, the page will redirect and you won't see any message unless you send it to the following page to be displayed.
You'll need to put your redirect in a conditional statement as well. If there are errors, don't do it and print the message on the page instead.
See what I mean?