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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -