Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialX X
90 PointsForm
Hi, I wanted to add on my website form that would be send to my e-mail but it doesn't work.
HTML
<form action="kontakt.php" method="post"> <div class="formularz"> <table> <tr> <td align="right">Imię:</td> <td><input type="text" name="name" placeholder="Jan" /></td> </tr> <tr> <td align="right">Nazwisko:</td> <td><input type="text" name="surname" placeholder="Kowalski" /></td> </tr> <tr> <td align="right">e-mail:</td> <td><input type="text" name="email" placeholder="jan.kowalski@gmail.com" /></td> </tr> <tr> <td align="right">Treść wiadomości:</td> <td><textarea name="message" cols="20" rows="10" placeholder="Tutaj napisz wiadomość"></textarea></td> </tr> <tr> <br> <td colspan="2" align="center"><br> <input type="submit" value="Wyślij" /> <input type="reset" value="Wyczyść" /> </td> </tr> </table> </div> </form>
PHP code
<?php
$name = $_POST['name'];
$surname = $_POST['surname'];
$email = $_POST['email'];
$message = $_POST['message'];
$odkogo = "pawel13fk@o2.pl";
$dokogo = "veritimus@o2.pl";
$tytul = "Formularz ze strony Zaneta Art";
$wiadomosc = ""; $wiadomosc .= "Imię: " . $name . "\n"; $wiadomosc .= "Nazwisko: " . $surname . "\n"; $wiadomosc .= "e-mail: " . $email . "\n"; $wiadomosc .= "Treść wiadomości: " . $message . "\n";
$naglowek = ""; $naglowek .= "Od:" . $odkogo . " \n"; $naglowek .= "Content-Type:text/plain;charset=utf-8";
$sukces = mail($dokogo, $tytul, $wiadomosc, $naglowek);
if ($sukces){ print "<meta http-equiv='\"refresh\"' content='\"0;URL=potwierdzenie.html\"'>"; } else{ print "<meta http-equiv='\"refresh\"' content='\"0;URL=error.html\"'>"; } ?>
When I type informations into input labels and click "send" button, I don't receive any message on my e-mail.
What I've already noticed, my hrefs also doesn't work with subpages on my website. When I click button with href, browser open the page with communique that connection seems to be not safe.
www.zaneta-art.jcom.pl/kontakt.html - link to subpage with form.
2 Answers
Kristian Terziev
28,449 PointsMaking a form send a message might be a bit more tricky then you expect. Check out this video to see how Randy solved this issue using a third party library.
X X
90 PointsIs that a reason of communique about not safe connection between subpages?