hi. ich kann den fehler in folgendem script leider nicht finden :-( hoffe ihr könnt mir weiterhelfen. angeblich liegt er in zeile 67 oder so, also genau da wo steht: $toAddress="... Aber was soll da falsch sein? sind noch mehr fehler drin? Danke für die Hilfe, falls da wer durchblickt
PHP-Code:
<html>
<head>
</head>
<body>
<?php
/* grabs the POST variables and puts them into variables that we can use */
$vorname = $_POST['vorname'];
$nachname = $_POST['nachname'];
$email = $_POST['email'];
$strasse = $_POST['strasse'];
$plz = $_POST['plz'];
$wohnort = $_POST['wohnort'];
$tel = $_POST['tel'];
$fax = $_POST['fax'];
$homepage = $_POST['homepage'];
//---------VALIDATION-------->
if($vorname){//----> CHECK input
}
else{
$error.="Please, go back and fill out your first name\n";//----> ERROR if no input
}
if($nachname){//----> CHECK input
}
else{
$error.="Please, go back and fill out your last name\n";//----> ERROR if no input
}
if($email){//----> CHECK input
}
else{
$error.="Please, go back and fill out your e-mail address\n";//----> ERROR if no input
}
if($tel){//----> CHECK input
}
else{
$error.="Please, go back and fill out your phone number\n";//----> ERROR if no input
}
if($strasse){//----> CHECK input
}
else{
$error.="Please, go back and fill out your mailing address\n";//----> ERROR if no input
}
if($wohnort){//----> CHECK input
}
else{
$error.="Please, go back and fill out your city name\n";//----> ERROR if no input
}
if($plz){//----> CHECK input
}
else{
$error.="Please, go back and fill out your zip code\n";//----> ERROR if no input
}
//-------->ERROR FREE??
if($error == "") {
echo "Thank you for inquiring about us! A receipt of your submission will be e-mailed to you almost immediately.";
}
//----------------------------------
$mailContent = "--------CONTACT--------\n"
."First Name: ".$vorname."\n"
."Last Name: ".$nachname."\n"
."E-mail: ".$email."\n"
."Website: ".$homepage."\n\n--------PHONE--------\n"
."Phone: ".$tel."\n"
."Fax: ".$fax."\n"
."Street Address: ".$strasse."\n"
."City: ".$wohnort."\n"
."Zip Code: ".$plz."\n\n--------INFO--------\n"
//----------------------------------
$toAddress = "meine@mail.com";
$subject = "Betreff fuer Homepagebesitzer";
$recipientSubject = "Betreff fuer Absender";
$receiptMessage = "Thank you ".$vorname." for inquiring about MyWebSite.com's Products!\n\n\nHere is what you submitted to us:\n\n"
."--------CONTACT--------\n"
."First Name: ".$vorname."\n"
."Last Name: ".$nachname."\n"
."E-mail: ".$email."\n"
."Website: ".$homepage."\n\n--------PHONE--------\n"
."Phone: ".$tel."\n"
."Fax: ".$fax."\n"
."Street Address: ".$strasse."\n"
."City: ".$wohnort."\n"
."Zip Code: ".$plz."\n\n--------INFO--------\n"
//----------------------------------
mail($email, $subject, $receiptMessage,"From:$toAddress");
//----------------------------------
mail($toAddress,$recipientSubject,$mailContent,"From:$email");
//--->echo $mailContent;
//////////////////////////////////////// CONNECT TO MYSQL DB ////////////////////
// OPEN CONNECTION --->
$connection = mysql_connect("mysql","YXYX", "YXYXYX") or die("Unable to connect!"); /* change this! */
mysql_select_db("XYZ") or die("Unable to select database!"); /* change this! */
// EXECUTE QUERY --->
$query="INSERT INTO kontaktformular (
vorname,
nachname,
email,
strasse,
plz,
wohnort,
tel,
fax,
homepage)
VALUES(
'".$vorname."',
'".$nachname."',
'".$email."',
'".$strasse."',
'".$plz."',
'".$wohnort."',
'".$tel."',
'".$fax."',
'".$homepage."')";
//////----->
$result = mysql_query($query) or die("Error in query:".mysql_error());
//if ($result)
//echo mysql_affected_rows()." row inserted into the database effectively.";
// CLOSE CONNECTION --->
mysql_close($connection);
///////////////////////////////////////////////////////////////////////////////////
}
else{
print "Sorry, but the form cannot be sent until the fields indicated are filled out completely - \n";
print "$error\n";
print "\n";
print "\n";
print "Please use your \"Back\" button to return to the form to correct the omissions. Thank you.\n";
}
?>
</body>
</html>
Kommentar