PHP: Header doesn't redirect page after form submit -


what problem code? after submitting form, page doesn't redirected coming soon.html; instead, shows blank. , apage exists!

<?php  if(empty($name) || empty($surname) || empty($email)){     return false; } else {     header('location: coming soon.html'); } $name = $_post['name']; $surname = $_post['last_name']; $cons = $_post['cons']; $password = $_post['pass']; $email = $_post['email']; $message = $_post['message']; $subject = $_post['subject']; $recipient = "pixiedustmed@yahoo.com"; $msg = "please fill in required fields*";  $to = 'pixiedustmed@yahoo.com';  $subject = "contact message from: $name $surname - $email - subject: $subject";  $headers = "from: $name $surname \r\n"; $headers .= "reply-to: ". strip_tags($_post['email']) . "\r\n"; $headers .= "cc: avedis@avedis.ga\r\n"; $headers .= "mime-version: 1.0\r\n"; $headers .= "content-type: text/html; charset=iso-8859-1\r\n";  $message = '<html><body>'; $message .= '<div class="about-center"><h1 style="font-family: lato-light; font-size: 2em">you have received contact message website.</h1></div>'; $message .= '<table rules="all" style="border-color: #666; font-family: segoe ui; font-size: 16px;" cellpadding="12">'; $message .= "<tr style='background: #eee;'><td><p style='color: #2c3e50; font-weight:bold'>name:&nbsp;</p> </td><td>" . strip_tags($_post['name']) . "</td></tr>"; $message .= "<tr style='background: #eee;'><td><p style='color: #2c3e50; font-weight:bold'>surname:&nbsp;</p> </td><td>" . strip_tags($_post['last_name']) . "</td></tr>"; $message .= "<tr style='background:#2ecc71;'><td><p style='color: #2c3e50; font-family: calibri;'>subject:&nbsp;</p> </td><td style='font-family:calibri;'>" . strip_tags($_post['subject']) . "</td></tr>"; $message .= "<tr><td><p style='color: #2c3e50; font-weight:bold'>email:&nbsp;</p> </td><td>" . strip_tags($_post['email']) . "</td></tr>"; $message .= "<tr style='background: #71bdf4;'><td><p style='color: #ffffff'>message:&nbsp;</p> </td><td>" . strip_tags($_post['message']) . "</td></tr>"; $message .= "<tr style='background: #34495e;'><td><p style='color: #ffffff'>consultation info:&nbsp;</p> </td><td style='color: #ffffff'>" . strip_tags($_post['cons']) . "</td></tr>"; $message .= "<tr><td><p style='color: #2c3e50; font-weight:bold'>password:&nbsp;</p> </td><td>" . strip_tags($_post['pass']) . "</td></tr>"; $message .= "</table>"; $message .= '<br><h1 style="font-family: lato-light; font-size: 14px; color:#c0392b;"><a href="http://avedis.ga">click here open avedis.ga</a></h1>'; $message .= '<h1 style="font-family: segoe ui; font-size: 13px; color:#eee;">this autogenerated message designed s.g.</h1>'; $message .= '<div class="about-center">-</div>'; $message .= "</body></html>";   mail($recipient, $subject, $message, $headers, $password) or die("error!"); ?> 

this web page: avedis.ga, try @ end of page, , let me know think design , all...

your $name, $surname , $email variables null @ moment of checking whether redirect, or not.

this

$name = $_post['name']; $surname = $_post['last_name']; $email = $_post['email']; 

should go before this

if (empty($name) || empty($surname) || empty($email)){     return false; } else {     header('location: coming soon.html'); } 

also not recommend use spaces in filenames web.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -