Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Java][PHP]Formularz z wysyłaniem na e-maila Json
awek320
post
Post #1





Grupa: Zarejestrowani
Postów: 15
Pomógł: 0
Dołączył: 17.11.2014

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


Witam. Mam skrypt który jakoś nie działa ostatnio poprawnie..
Proszę.

  1. <div id="contact-section">
  2. <h3>Zapytaj o wolny termin</h3>
  3. <div class="alert alert-success" style="display: none"></div>
  4. <form id="main-contact-form" class="contact-form" name="contact-form" method="post" action="sendemail.php">
  5. <div class="form-group">
  6. <input type="text" name="name" class="form-control" required="required" placeholder="Imię i Nazwisko">
  7. </div>
  8. <div class="form-group">
  9. <input type="email" name="email" class="form-control" required="required" placeholder="Adres E-mail">
  10. </div>
  11. <div class="form-group">
  12. <textarea name="message" id="message" required="required" class="form-control" rows="4" placeholder="Treść wiadomości"></textarea>
  13. </div>
  14. <div class="form-group">
  15. <button type="submit" class="btn btn-primary pull-right">Wyślij</button>
  16. </div>
  17. </form>
  18. </div>


  1. <?php
  2. //header('Content-type: application/json');
  3. $status = array(
  4. 'type'=>'success',
  5. 'message'=>'Dziękuję za wysłanie wiadomości, odpowiem najszybciej jak się da. '
  6. );
  7.  
  8. $name = @trim(stripslashes($_POST['name']));
  9. $email = @trim(stripslashes($_POST['email']));
  10. $subject = @trim(stripslashes($_POST['subject']));
  11. $message = @trim(stripslashes($_POST['message']));
  12.  
  13. $email_from = $email;
  14. $email_to = 'slawek.krybus@gmail.com';//replace with your email
  15.  
  16. $body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;
  17.  
  18. $success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');
  19.  
  20. echo json_encode($status);
  21. die;
  22. ?>



Proszę o powiedzieć co jest nie tak ?

Po wysłaniu formularzu emaila przychodzi ale pojawia się biała strona z tym co jest w succes.. ale czy to nie powinno pojawić się na stronie głównej w ramce?

Pozdrawiam i proszę o pomoc
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: 20.08.2025 - 11:02