Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][PHP]Jak umieścić checkbox w wiadomości email
brt00
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 4.06.2013

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


Witam, mam swój formularz w pliku html:
  1. <form action="wypelnij_formularz.php" method="post" id="sky-form" class="sky-form">
  2.           <fieldset>
  3.               <section class="col col-6">
  4.                 <label class="label">Imię / Nazwa firmy *</label>
  5.                 <label class="input">
  6.                   <input type="text" name="name" id="name">
  7.                 </label>
  8.                 <label class="label">Numer telefonu *</label>
  9.                 <label class="input">
  10.                   <input type="text" name="nr" id="nr">
  11.                 </label>
  12.                 <label class="label">Adres email</label>
  13.                 <label class="input">
  14.                   <input type="email" name="email" id="email">
  15.                 </label>
  16.                 <label class="label">Wiadomość</label>
  17.               <label class="textarea">
  18.                 <textarea rows="4" name="message" id="message"></textarea>
  19.               </label>
  20.               <label class="checkbox"><input type="checkbox" name="zgoda" id="zgoda"><i></i>Wyrażam zgodę.</label>
  21.               </section>
  22.               <section class="col col-6">
  23.                 <label class="label">Temat *</label>
  24.                 <label class="checkbox"><input type="checkbox" name="poz1" id="poz1"><i></i>POZ1</label>
  25.                 <label class="checkbox"><input type="checkbox" name="poz2" id="poz2"><i></i>POZ2</label>
  26.                 <label class="checkbox"><input type="checkbox" name="sklep" id="sklep"><i></i>POZ3</label>
  27.               </section>
  28.           </fieldset>
  29.           <footer>
  30.             <button action="wypelnij_formularz.php" method="post" type="submit" class="button">Wyślij</button>
  31.             <p style="float:right">Pola oznaczone * są obowiązkowe</p>
  32.           </footer>
  33.         </form>


I plik PHP, który odpowiada za wysyłkę maila:
  1. <?php
  2. if( isset($_POST['name']) )
  3. {
  4.     $to = 'biuro@strona.pl';
  5.    
  6.     $subject = 'Setbrand.pl | formularz kontaktowy';
  7.     $message = $_POST['message'] . "\n\n" . 'Imię / Nazwa firmy: ' . $_POST['name'] . '.' . "\n\n" . 'Numer telefonu: ' . $_POST['nr'] . '.' . "\n\n" . 'Email: ' . $_POST['email'] . '.';
  8.     $headers = 'From: ' . $_POST['name'] . "\r\n" . 'Reply-To: ' . $_POST['email'] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
  9.     mail($to, $subject, $message, $headers);
  10.     if( $_POST['copy'] == 'on' )
  11.     {
  12.         mail($_POST['email'], $subject, $message, $headers);
  13.     }
  14. }
  15. ?>


Moje pytanie brzmi następująco: Jak dodać do pliku PHP kod, żeby w mailu wyświetlało się które pola checkbox użytkownik zaznaczył (chodzi o temat: POZ1 POZ2 POZ3). Jeśli to możliwe proszę o kawałek kodu, który będę musiał wkleić prawdopodobnie w linii z $message.
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 24.08.2025 - 06:50