![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 3 Pomógł: 0 Dołączył: 10.02.2012 Ostrzeżenie: (0%) ![]() ![]() |
Witam wszystkich jestem nowym urzytkownikiem borykajacym sie z nastepujacym problemem.
Na stronie mam formularz po wypełnieniu ktorego powinien zostac wysłany mail do mnie. Skrzynka jest przypisana jako domyslna na serwerze hostingowym wiec to działa. Wydaje mi sie ze blad jest gdzies w skrypcie ale nie moge znalezc gdzie: Kod formularza na contact.html <form action=?mailer.php? method=?POST?> <input type="text" name="First" size=:"50" />First name<br /> <input type="text" name="Last" size=:"50" />Last name<br /> <input type="text" name="Street" size=:"50" />Street Address<br /> <input type="text" name="City" size=:"50" />City<br /> <input type="text" name="Postal" size=:"50" maxlength="6" />Postal Code<br /> <input type="text" name="Phone1" size=:"50" maxlength="10" />First phone<br /> <input type="text" name="Phone2" size=:"50" maxlength="10" />Second phone<br /> <input type="text" name="letter" size=:"50" />e-mail<br /> <input type="checkbox" name="waterfall" value="yes" />Do you have waterfall?<br /> <input type="checkbox" name="spa" value="yes" />Do you have SPA?<br /> <input type="checkbox" name="fountain" value="yes" />Do you have fountain?<br /> <p>Type of cover?</p> <input type="radio" name="cover" value="waterbags" /> Waterbags <input type="radio" name="cover" value="safety-cover" /> Safety Cover <input type="radio" name="cover" value="clip-in" /> Clip-in<br /> <input type="radio" name="cover" value="unknown" /> Different/I don't know<br /> </td> </tr> </table> <textarea name="message" cols="70" rows="20">Message</textarea><br /> <input type="submit" name=?submit" value="Send" /> </form> A to kod mailer.php <?php if(isset($_POST['submit'])) { $myemail = 'info@pfpools.com'; $street = $_POST['Street']; $city = $_POST['City']; $postal = $_POST['Postal']; $phone1 = $_POST['phone1']; $phone2 = $_POST['phone2']; $letter = $_POST['e-mail']; $waterfall = $_POST['waterfall']; $spa = $_POST['SPA']; $fountain = $_POST['fountain']; $cover = $_POST['cover']; $message = $_POST['message']; $headers = ?From:Contact Form <$myemail>\r\n?; $headers = ?Reply-To: $first $last <$letter>\r\n?; echo ?Your message has been sent successfully!?; mail($myemail, $street, $city, $postal, $phone1, $phone2, $letter, $waterfall, $spa, $fountain, $cover, $message, $headers); } else { echo ?An error occurred during the submission of your message?; } ?> Jakis pomysl jak rozwiazac ten problem? P.S. Po wypisaniu formularza i wyslaniu przekierowywuje mnie na strone 404. Ten post edytował kubosz00 10.02.2012, 23:55:57 |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 3 Pomógł: 0 Dołączył: 10.02.2012 Ostrzeżenie: (0%) ![]() ![]() |
Dzieki wszystkim za zainteresowanie tematem:-D
Cytat ale chyba nie jestes uzytkownikiem slownika, co? Tego dnia niestety slownik mnie opuscil. Cytat funkcja mail może byc zablokowana na twoim serwerze, urzyj klasy phpmailer Funkcja mail na serwerze dziala, pytalem na help desku. Ogolnie to jestem zielony w sprawach php, kilka lat lemu bawilem sie amatorsko w robienie stron w html, jednorazowo do tego powrocilem z zamiarem zrobienia tylko jednej strony. Kod ktory mam znalazlem na FAQ firmy hostingujacej, oryginalnie wygladalo to tak Cytat Our servers require SMTP authentication, which in plain English means you will have to use any of your e-mail accounts, created within the E-mail Manager -> E-mail Accounts section from your control panel. You can see the code of an example contact form below(contact.html): <html> <head> <title> Contact form </title> </head> <body> <center> <font size="5"> <b> Contact form </b> <br> <br> </font> <form method="POST" action="mailer.php"> Subject: <input type="text" name="subject" size="20"> <br> <br> Name: <input type="text" name="name" size="20"> <br> <br> E-mail: <input type="text" name="email" size="20"> <br> <br> Message:<br> <textarea rows="9" name="message" cols="30"> </textarea> <br> <br> <input type="submit" value="Send" name="submit"> </form> </center> </body> </html> To have the form working you will also have to create a file called mailer.php with the below code: <?php if(isset($_POST['submit'])) { $myemail = "youremail@yourdomain.com"; Caution: replace youremail@yourdomain.com with a vaild one you created in Email Manager $subject = $_POST['subject']; $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $headers = "From:Contact Form <$myemail>\r\n"; $headers .= "Reply-To: $name <$email>\r\n"; echo "Your message has been sent successfully!"; mail($myemail, $subject, $message, $headers); } else { echo "An error occurred during the submission of your message"; } ?> If you already have a non-working contact form try adding the following variables and check if it works: $mymail = .youremail@yourdomain.com"; $headers = .From:Contact Form <$myemail>\r\n"; $headers .= .Reply-To: $name <$email>\r\n"; mail($mymail, $subject, $message ,$headers); NOTE: The Reply-To header could be set with different variable than $email, depending on the contact form itself. If your contact form already has the $header or $headers variable you will have to add the code with the following change: $mymail = .youremail@account.com"; $headers .= .From:Contact Form <$myemail>\r\n"; $headers .= .Reply-To: $name <$email>\r\n"; mail($mymail, $subject, $message ,$header); NOTE: The Reply-To header could be set with different variable than $email, depending on the contact form itself. If you wish the messages from the contact form to be received in e-mail box which is not on our servers just replace the $mymail in the mail() function with the e-mail where the e-mails should be sent to. Wydaje mi sie ze zrobilem wszystko analogicznie do powyzszego przykladu? Ten post edytował kubosz00 11.02.2012, 16:10:54 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 11.10.2025 - 15:50 |