Can somebody help me sovle this problem.
I have made a phpform (using a phpgenerator) with upload funktion.
The thing it should do is to make the felt: name, email, band and besked as requiered felts and the upload optional. But the thing it does is that it only works where a file is upload other wise it gives me the error msg down in the buttom.
Can anyone help me??
Thanks, Mads
CODE:
<?php include("global.inc.php"); $errors=0; $error="The following errors occured while processing your form input.- ";
pt_register('POST','Name');
pt_register('POST','Email');
pt_register('POST','Band');
pt_register('POST','Besked');
$Besked=preg_replace("/(1512)|(15)|(12)/","
- Du mangle at udfylde nogle felter som er n?dvendige. Pr?v igen."; } if($HTTP_POST_FILES['upload']['tmp_name']==""){ } else if(!is_uploaded_file($HTTP_POST_FILES['upload']['tmp_name'])){ $error.="
- The file, ".$HTTP_POST_FILES['upload']['name'].", was not uploaded!"; $errors=1; } if(!eregi("^[a-z0-9]+([_\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([.-][a-z0-9]+)*)+"."\.[a-z]{2,}"."$",$Email)){ $error.="
- Ugyldig email adressse";
$errors=1;
}
if($errors==1) echo $error;
else{
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['upload']['name'];
$image_list[4] = $image_part;
copy($HTTP_POST_FILES['upload']['tmp_name'], "files/".$image_part);
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: ".$Name."
Email: ".$Email."
Band: ".$Band."
Besked: ".$Besked."
upload: ".$where_form_is."files/".$image_list[4]."
";
$message = stripslashes($message);
mail("[email protected]","Materiale Bestilling",$message,"From: Oldnick");
header("Refresh: 0;url=http://oldnick.dk/print/print_sider/form_tak.html");
?><?php
}
?>ERROS: I have masked the ulr.
Warning: Unable to access in /customers/xxxxxx.dk/xxxxxx.dk/httpd.www/print/print_sider/requiest.php on line 27
Warning: Cannot add header information - headers already sent by (output started at /customers/xxxxxxx.dk/xxxxxx.dk/httpd.www/print/print_sider/requiest.php:27) in /customers/xxxxxxx.dk/xxxxxxx.dk/httpd.www/print/print_sider/requiest.php on line 38
", $Besked);$upload=$HTTP_POST_FILES['upload']; if($Name=="" || $Email=="" || $Band=="" || $Besked=="" ){ $errors=1; $error.="