email - 'Simple' PHP script shows error in line 10, what have I done wrong? -
my freshly updated website has contact form php mail script based on form script here.
the script saved on webserver, when data submitted, no mails sent there fault in line 10.
i don't understand enough pinpoint error - can newbie out?
i found temporary replacement using bravenet, i'd use unbranded version, if simple php scripts simple seem…
my script (kontakt.php) looks this:
<?php /* set e-mail recipient */ $myemail = "edw@rdturner.co.uk"; /* check form inputs using check_input function */ $name = check_input($_post['name'], "ihr name"); $email = check_input($_post['email'], "ihre e-mail-adresse"); $kontaktnummer = check_input($_post['kontaktnummer']); $thema = check_input($_post['them']); $message = check_input($_post['message']), "worum geht's?"); /* if e-mail not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) { show_error("e-mail-adresse ungültig"); } /* let's prepare message e-mail */ $message = "hallo! ihr form ist unterwegs…: name: $name e-mail-adresse: $email kontaktnummer: $kontaktnummer frage zum thema? $thema nachricht: $message comments: $comments end of message "; /* send message using mail() function */ mail($myemail, $subject, $message); /* redirect visitor thank page */ header('location: danke.htm'); exit(); /* functions used */ function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myerror) { ?> <html> <body> <b>hier stimmt nicht - bitte prüfen!</b><br /> <?php echo $myerror; ?> </body> </html> <?php exit(); } ?>
and submission form this:
<form method="post" enctype="multipart/form-data" action="http://pub14.bravenet.com/emailfwd/senddata.php" accept-charset="utf-8"> <input type="hidden" name="usernum" value="1126560145"> <input type="hidden" name="cpv" value="2"> <ol><li> <label for="name">name (erförderlich)</label> <input id="name" name="name" class="text" /> </li><li> <label for="email">e-mail-adresse (erförderlich)</label> <input id="email" name="email" class="text" /> </li><li> <label for="kontaktnummer">kontaktnummer (erförderlich)</label> <input id="kontaktnummer" name="kontaktnummer" class="text" /> </li><li> <label for="thema">fragen zum thema (erförderlich)</label></br> <input type="checkbox" name="thema" value="unterricht" /> unterricht</br> <input type="checkbox" name="thema" value="übersetzungen" /> Übersetzungen</br> <input type="checkbox" name="thema" value="dolmetschen" /> dolmetschen</br> <input type="checkbox" name="thema" value="faß" /> englsich vom faß</br> <input type="checkbox" name="thema" value="anders" /> andere </li><li> <label for="message">worum geht's? (erförderlich)</label> <textarea id="message" name="message" rows="8" cols="50"></textarea> </li><li> <input type="image" name="imagefield" id="imagefield" src="images/submit.gif" class="send" /> <div class="clr"></div> </li></ol> </form>
naturally i'll need tweak html reflect newly working script… how?
thanks in advance
edd turner
$message = check_input($_post['message']), "worum geht's?");
to
$message = check_input($_post['message'], "worum geht's?");
there ) in wrong place.
Comments
Post a Comment