php - Provide information to the customer immediately - rather than reload the page -
i give our customer beskede have been written beskede person , contacted possible, @ present page reload. has send same time provide information sent.
my mind use javascript or jquery or ajax, area don't know :)
<div class="kontakt_box"> <h3>kontakt mads Ørnfeldt andersen</h3> <p>kom kontakt med mads Ørnfeldt andersen</p> <?php $email_afsender = $mebe->email_afsender(); ?> <form action="#" method="post" name="kontakt_box"> <label>navn<br /><input type="text" name="navn" required title="angive et navn" class="new" placeholder="navn"></label><br /> <label>efternavn<br /><input type="text" required title="angive et efternavn" name="efternavn" class="new" placeholder="efternavn"></label><br /> <label>email<br /><input type="email" required title="angive en email!" name="email" class="new" placeholder="email"></label><br /> <label>tekst<br /><textarea name="tekst" cols="35" rows="10" class="new" required title="skrive noget indhold email!!" placeholder="tekst til email"></textarea></label><br /> <label><input type="submit" name="send" value="send" class="new"></label> </form> </div>
here code code:
function email_afsender() { if(isset($_post["send"])) { $fra = $_post["navn"] . " " . $_post["efternavn"] . "<" . $_post["email"] . ">"; $til = "hello@world.dk"; $emne = "kontakt blabla.dk - " . $_post["navn"] . " " . $_post["efternavn"]; $besked = $_post["tekst"]; //headers $headers = "mime-version: 1.0\r\n"; $headers .= "content-type: text/html; charset=utf-8\r\n"; $headers .= "from: " . $fra . "\r\n"; mail($til, $emne, $besked, $headers); ?> <script language="javascript" type="text/javascript"> window.location.href = "/kontakt/"; </script> <?php } }
what problem is:
i send email show message user email has been sent below form: "thank @ case possible."
you can see problem here
sorry english bad i'm dyslexic , have difficulty it.
i think problem not beeing dyslexic, using google translate.
instead of using:
<script language="javascript" type="text/javascript"> window.location.href = "/kontakt/"; </script>
you should http redirect:
header('location: ' . $targetpage);
Comments
Post a Comment