Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Wysyłanie formularza
gg1985
post
Post #1





Grupa: Zarejestrowani
Postów: 174
Pomógł: 3
Dołączył: 23.02.2008

Ostrzeżenie: (0%)
-----


Witam

Czemu mi to nie działa ?

  1. <?php
  2. if (count($_POST)) {
  3.            $email = 'adres';    // Adres e-mail adresata
  4.            $subject = 'Kontakt ze strony adres';    // Temat listu
  5.            $message = '<p>Dziękujemy za wysłanie zapytania. Odpowiemy w przeciągu 12h.</p>';    // Komunikat
  6.            $error = 'Wystąpił błąd podczas wysyłania formularza';    // Komunikat błędu
  7.            $charset = 'iso-8859-2';    // Strona kodowa
  8.            //////////////////////////////
  9.            
  10.            $head =
  11.                "MIME-Version: 1.0r\n" .
  12.                "Content-Type: text/plain; charset=$charsetr\n" .
  13.                "Content-Transfer-Encoding: 8bit";
  14.            $body = '';
  15.            foreach ($_POST as $name => $value)
  16.            {
  17.                if (is_array($value))
  18.                {
  19.                    for ($i = 0; $i < count($value); $i++)
  20.                    {
  21.                        $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value[$i]) : $value[$i]) . "r\n";
  22.                    }
  23.                }
  24.                else $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value) : $value) . "r\n";
  25.            }
  26.            echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error;
  27.        }
  28.        else { ?>
  29.            <form action="">
  30.                <fieldset>
  31.                    <p><input type="text" id="name" name="Imię i nazwisko" /><label>Imię i nazwisko *</label></p>
  32.                    <p><input type="text" name="Firma" /><label>Firma</label></p>
  33.                    <p><input type="text" name="Telefon" /><label>Telefon</label></p>
  34.                    <p><input type="text" id="mail" name="Adres e-mail" /><label>Adres e-mail *</label></p>
  35.                    <p><textarea rows="6" id="ask" name="Pytanie" ></textarea><label>Treść pytania *</label></p>
  36.                    <p><input type="submit" value="wyślij" class="submit"/></p>
  37.                </fieldset>
  38.            </form>
  39. <?php } ?>


Ten post edytował Spawnm 19.07.2009, 12:23:23


--------------------
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 15:38