Hallo
Ik ben nieuw in php en schreef het volgende script:
<?php
$naam = $_HTTP_POST_VARS['naam'];
$email = $HTTP_POST_VARS['email'];
$tel = $HTTP_POST_VARS['telefoon'];
$adres = $HTTP_POST_VARS['adres'];
$naamProduct = $HTTP_POST_VARS['naamProduct'];
$aantal = $HTTP_POST_VARS['aantal'];
$formaat = $HTTP_POST_VARS['formaat'];
$papier = $HTTP_POST_VARS['papier'];
$bedrukking = $HTTP_POST_VARS['bedrukking'];
$afwerking = $HTTP_POST_VARS['afwerking'];
copy ($_FILES['file']['tmp_name'], "upload/".$_FILES['file']['name']) or die ('Could not upload');
$to = "[email protected]";
$subject = "Bestelling van drukwerk via de site";
$from_header = "From: $email";
$contents .= "Dit bericht is afkomstig van: \r\n";
$contents .= "Naam: " . $naam ."\r\n";
$contents .= "Email: " .$email. "\r\n";
$contents .= "Telefoon: " .$tel."\r\n";
$contents .= "Adres: " . $adres . "\r\n";
$contents .= "\r\nDe bestelling houdt het volgende in: \r\n";
$contents .= "Naam product: ".$naamProduct."\r\n";
$contents .= "Aantal: ".$aantal."\r\n";
$contents .= "Formaat: " .$formaat."\r\n";
$contents .= "Papier: " .$papier."\r\n";
$contents .= "Bedrukking: " .$bedrukking."\r\n";
$contents .= "Afwerking: ".$afwerking."\r\n";
//send mail - $subject & $contents come from surfer input
mail($to, $subject, $contents, $from_header);
// redirect back to url visitor came from
echo "Het formulier werd goed verzonden.<br/>";
?>
Zonder de lijn van copy (om bestand naar ftp te uploaden) gaf hij geen foutmelding en kwamen de mails toe. Nu geeft hij echter de volgende foutmelding:
PHP Notice: Undefined index: naam in D:\iisstorage\web\goedkoopdrukwerk.be\wwwroot\sendmail.php on line 3 PHP Notice: Undefined variable: HTTP_POST_VARS in D:\iisstorage\web\goedkoopdrukwerk.be\wwwroot\sendmail.php on line 4 PHP Notice: Undefined variable: HTTP_POST_VARS in D:\iisstorage\web\goedkoopdrukwerk.be\wwwroot\sendmail.php on line 5 PHP Notice: Undefined variable: HTTP_POST_VARS in D:\iisstorage\web\goedkoopdrukwerk.be\wwwroot\sendmail.php on line 6 PHP Notice: Undefined variable: HTTP_POST_VARS in D:\iisstorage\web\goedkoopdrukwerk.be\wwwroot\sendmail.php on line 7 PHP Notice: Undefined variable: HTTP_POST_VARS in D:\iisstorage\web\goedkoopdrukwerk.be\wwwroot\sendmail.php on line 8 PHP Notice: Undefined variable: HTTP_POST_VARS in D:\iisstorage\web\goedkoopdrukwerk.be\wwwroot\sendmail.php on line 9 PHP Notice: Undefined variable: HTTP_POST_VARS in D:\iisstorage\web\goedkoopdrukwerk.be\wwwroot\sendmail.php on line 10 PHP Notice: Undefined variable: HTTP_POST_VARS in D:\iisstorage\web\goedkoopdrukwerk.be\wwwroot\sendmail.php on line 11 PHP Notice: Undefined variable: HTTP_POST_VARS in D:\iisstorage\web\goedkoopdrukwerk.be\wwwroot\sendmail.php on line 12 PHP Notice: Undefined index: file in D:\iisstorage\web\goedkoopdrukwerk.be\wwwroot\sendmail.php on line 13 PHP Notice: Undefined index: file in D:\iisstorage\web\goedkoopdrukwerk.be\wwwroot\sendmail.php on line 13 PHP Warning: copy() [function.copy]: open_basedir restriction in effect. File() is not within the allowed path(s): (C:\inetpub\wwwroot;c:\windows\temp;/tmp;D:\iisstorage) in D:\iisstorage\web\goedkoopdrukwerk.be\wwwroot\sendmail.php on line 13
Wat doe ik juist verkeerd? Kan iemand me ook uitleggen hoe ik controleer of alles ingevuld is?
Bedankt!
Annelies
1.130 views