gastroll
New Members-
Posts
5 -
Joined
-
Last visited
Never
Everything posted by gastroll
-
Ups, sorry next time I will use the right code highlight thing. Fiiinaly I got a email in my account: the test mail worked. So can anyone see what I am doing wrong on my original kontakt-sent.php? : <?php if(isset($_POST['submit'])) { $to = 'my@website.de'; $subject = $_POST['betreff'] ; $name = $_POST['name'] ; $email = $_POST['email'] ; $adresse = $_POST['adresse'] ; $telefon = $_POST['tele'] ; $unternehmensname = $_POST['uname'] ; $website = $_POST['website'] ; $unternehmenstyp = $_POST['unternehmenstyp'] ; $anschreiben = $_POST['anschreiben'] ; $headers = "From: $email"; $message = " See information from form below,\n\n Betreff: $betreff\n Name: $name\n Email: $email\n Adresse: $adresse\n Telefon: $telefon\n Unternehmensname: $unternehmensname\n Website: $website\n Unternehmenstyp: $unternehmenstyp\n Anschreiben: $anschreiben\n\n\n"; // Send the message $sendit = @mail($to, $subject, $message, $headers); if($sendit){ header("Location: http://www.mywebsite.de/kontakt-gesendet.html"); }else{ header("Location: http://www.mywebsite.de/kontakt-error.html"); } } ?>
-
Hi, sorry that I respond so late (have been in holiday for a while). So put your test version in my file and it did not work out. here is my new php file. after submit the browser tells me: Parse error: syntax error, unexpected '{' in /homepages/xx/xxx/htdocs/xxx.de/kontakt-sent.php on line 5
-
Hey Twistedweb123, thanks for your post: I put your changes in my file. Here is my new file: <?php if(isset($_POST['submit'])) { $to = 'info@gastrollogy.de'; $subject = $_POST['betreff'] ; $name = $_POST['name'] ; $email = $_POST['email'] ; $adresse = $_POST['adresse'] ; $telefon = $_POST['tele'] ; $unternehmensname = $_POST['uname'] ; $website = $_POST['website'] ; $unternehmenstyp = $_POST['unternehmenstyp'] ; $anschreiben = $_POST['anschreiben'] ; $headers = "From: $email"; $message = " See information from form below,\n\n Betreff: $betreff\n Name: $name\n Email: $email\n Adresse: $adresse\n Telefon: $telefon\n Unternehmensname: $unternehmensname\n Website: $website\n Unternehmenstyp: $unternehmenstyp\n Anschreiben: $anschreiben\n\n\n"; // Send the message $sendit = @mail($to, $subject, $message, $headers); if($sendit){ header("Location: /restaurant-kontakt-gesendet.html"); }else{ header("Location: /restaurant-kontakt-error.html"); } } ?> But: (tested different email addresses) - did not received a email (no spam) - and after submitting the user is not redirected to the thank-you.html Any further idea?
-
Mail Form Redirect to Thankyou Page - php newbe
gastroll replied to Marcus2000's topic in PHP Coding Help
I am looking for the same thing. Someone told me I should insert if (mail($to, $...)) header("Location:/thankyou.html"); else header("Location:/error.html"); at the end but it did not work out for me. -
Hez guys, first of all I have to admit that I have NO clue about php and building an contact form is my first contact with it. However I use the following contact form: <form id="formID" class="formular" action="restaurant-kontakt-sent.php" method="post" > <fieldset> <legend> Persönliche Angaben </legend> <table> <tr> <td> <span style="color:#FF0000">*</span><span>Name:</span> </td> <td> <label> <input value="<?=$_SESSION['post']['name']?>" class="validate[required,custom[onlyLetterSp]] text-input" type="text" name="name" id="name" /> </label> </td> </tr> <tr> <td> <span style="color:#FF0000">*</span><span>Email: </span> </td> <td> <label> <input value="<?=$_SESSION['post']['email']?>" class="validate[required,custom[email]] text-input" type="text" name="email" id="email" /> </label> </td> </tr> <tr> <td> <span>Adresse:</span> </td> <td> <label> <input value="<?=$_SESSION['post']['adresse']?>" class="validate[custom[onlyLetterNumber]] text-input" type="text" name="adresse" id="adresse" /> </label> </td> </tr> <tr> <td> <span>Telefon: </span><br><span style="font-size:9px;">(Bitte mit Vorwahl)</span> </td> <td> <label> <input value="<?=$_SESSION['post']['tele']?>" class="validate[custom[phone]] text-input" type="text" name="tele" id="tele" /> </label> </td> </tr> </table> </fieldset> <fieldset> <legend> Weitere Angaben </legend> <table> <tr> <td> <span>Unternehmen:</span> </td> <td> <label> <input value="<?=$_SESSION['post']['uname']?>" class="validate[custom[onlyLetterNumber]] text-input" type="text" name="uname" id="uname" /> </label> </td> </tr> <tr> <td> <span>Website:</span> </td> <td> <label> <input value="http://" class="validate[custom[url]] text-input" type="text" name="website" id="website" /> </label> </td> </tr> <tr> <td> <span>Unternehmen <br>zuordnen:</span> </td> <td> <label> <select name="unternehmenstyp" id="unternehmenstyp" class="validate[custom]"> <option value="option1">Bars, Pubs & Kneipen</option> <option value="option2">Cafes & Bistros</option> <option value="option3">Catering & Partyservice</option> <option value="option1">Clubs & Diskotheken</option> <option value="option2">Events & Veranstaltungen</option> <option value="option3">Imbiss, Pizza & Fast Food</option> <option value="option1">Kinos</option> <option value="option2">Lieferservice</option> <option value="option3">Pensionen, Hostels & Jugendherbergen</option> <option value="option3">Restaurants</option> <option value="option3">Andere</option> </select> </td> </tr> </table> </label> </fieldset> <fieldset> <legend> Ihre Nachricht </legend> <table> <tr> <td> <span>Betreff:</span> </td> <td> <label> <input value="<?=$_SESSION['post']['betreff']?>" class="validate[custom[onlyLetterNumber]] text-input" type="text" name="betreff" id="betreff" /> </label> </td> </tr> <tr> <td> <span>Nachricht:</span> </td> <td> <label> <textarea class="validate[required] text-input" rows="4" cols="40" name="anschreiben" id="anschreiben" > <?=$_SESSION['post']['message']?> </textarea> </label> </td> </tr> </table> <!-- <div> <span>Datei zum Anhang hinzufügen:</span> <input class="validate[custom[]] text-input" type="file" name="anhang" id="anhang"/> </div> --> </fieldset> <input class="submit" type="submit" value="Senden!"/><hr/> </form> And the following restaurant-kontakt-sent.php: <?php if(isset($_POST['submit'])) { $to = 'info@mydomain.de'; $name = $_POST['name'] ; $email = $_POST['email'] ; $adresse = $_POST['adresse'] ; $telefon = $_POST['tele'] ; $unternehmensname = $_POST['uname'] ; $unternehmenstyp = $_POST['unternehmenstyp'] ; $betreff = $_POST['betreff'] ; $anschreiben = $_POST['anschreiben'] ; //$headers = "From: $Nachname <$Email>"; //$error = ""; //if (trim($nachname)=="" || trim($email)==""|| trim($anschreiben)=="" ) //{ //$error = "Ooops! Nachname, Emailadresse und Anschreiben sind Pflichtfelder." //} mail($to, $vorname, $nachname, $email, $adresse, $telefon, $unternehmensname, $unternehmenstyp, $betreff, $anschreiben) ; if (mail($to, $vorname, $nachname, $email, $adresse, $telefon, $unternehmensname, $unternehmenstyp, $betreff, $anschreiben)) header("Location:/restaurant-kontakt-gesendet.html"); else header("Location:/restaurant-kontakt-error.html"); } ?> My problem is: 1. There is no mail coming (my host is 1und1.de and it is not inside the span or junk folder)? 2. And after pushing the submit button the user gets not passed to the the restaurant-kontakt-error.html or restaurant-kontakt-gesendet.html. Could anyone give me the right direction?