Simple PHP Form Redirect -
i'm trying create simple redirect on form. form sends email when click submit, won't redirect url specified.
here's php code:
<?php if ($valid_message) { header("location: http://www.beulahprint.ie/energycentre.php"); exit(); } else {print "we encountered error sending mail"; } $to = "colm@beulahprint.ie"; $subject = "web contact form"; $email = $_request['email'] ; $message = $_request['message'] ; $headers = "from: $email"; $sent = mail($to, $subject, $message, $headers) ; ?>
your code seems out of order. first, send mail. then, if successful, redirect. try redirect send mail.
<?php $to = "colm@beulahprint.ie"; $subject = "web contact form"; $email = $_request['email'] ; $message = $_request['message'] ; $headers = "from: $email"; $sent = mail($to, $subject, $message, $headers) ; if ($sent) { header("location: http://www.beulahprint.ie/energycentre.php"); exit(); } else { print "we encountered error sending mail"; } ?>
Comments
Post a Comment