php - Clear form after submit and success message -
i made own contact form , sending mails want clear after succesfully submit , show message (pop window can good) success sending. here code , don't know do, ried few things nothing work.
<form id="contact-form" class="wniosek" action="wyslijwniosek.php" method="post"> <div class="col-sm-4"> <label class="firma rel col-sm-12"> <span class="inp"> <input name="firma" type="text" placeholder="nazwa firmy" class="col-sm-12"> </span> </label> </div> <div class="col-sm-4"> <label class="name rel col-sm-12"> <span class="inp"> <input name="name" type="text" placeholder="imię nazwisko" class="col-sm-12"> </span> </label> </div> <div class="col-sm-4"> <label class="phone rel col-sm-12"> <span class="inp"> <input name="phone" type="text" placeholder="telefon" class="col-sm-12"> </span> </label> </div> <div class="col-sm-4"> <label class="email rel col-sm-12"> <span class="inp"> <input name="email" type="text" placeholder="e-mail" class="col-sm-12"> </span> </label> </div> <div class="col-sm-4"> <label class="kwota rel col-sm-12"> <span class="inp"> <input name="kwota" type="text" placeholder="prognozowana kwota" class="col-sm-12"> </span> </label> </div> <div class="col-sm-4"> <label class="wnio col-sm-12"> <select name="wnio" style="width:100%;"> <option value="kredyt firmowy">kredyt firmowy</option> <option value="kredyt gotówkowy">kredyt gotówkowy</option> <option value="kredyt obrotowy">kredyt obrotowy</option> <option value="pożyczka hipoteczna">pożyczka hipoteczna</option> <option value="kredyt hipoteczny">kredyt hipoteczny</option> <option value="kredyt konsolidacyjny">kredyt konsolidacyjny</option> <option value="kredyt inwestycyjny">kredyt inwestycyjny</option> <option value="kredyt samochodowy">kredyt samochodowy</option> <option value="leasing">leasing</option> </select> </label> </div> <div class="col-sm-12"> <label class="message rel col-sm-12"> <span class="text_a"> <textarea name="message" class="col-sm-12" placeholder="wiadomość" style="height:300px;"></textarea> </span> </label> </div> <div class="col-sm-4"> <div class="buttons-wrapper"><input class="button2 btn btn-white" type="submit" value="wyślij"><input class="button2 btn btn-white" type="reset" value="wyczyść"> </div> </div> </form>
php:
<?php $firma = $_post['firma']; $name = $_post['name']; $email = $_post['email']; $phone = $_post['phone']; $wnio = $_post['wnio']; $kwota = $_post['kwota']; $message = $_post['message']; $formcontent=" nazwa firmy: $firma \n imie nazwisko: $name \n email: $email \n telefon: $phone \n wniosek: $wnio \n prognozowana kwota: $kwota \n wiadomość: $message"; $recipient = "<mymailhere>"; $subject = "formularz kontaktowy"; $mailheader = "from: $email"; mail($recipient, $subject, $formcontent, $mailheader); exit();//remove after debugging done ?>
use simple code
mail($recipient, $subject, $formcontent, $mailheader); header("location:wniosek.php?form=success");
and in wniosek.php
page use code display status
<?php if($_get['form']=="success") { echo "registered successfully"; } ?>
Comments
Post a Comment