<?php
if( isset($_POST['name']) )
{
$to = 'email@email.com';
$subject = $_POST['subject'];
$message = $_POST['message'] . "\n\n" . 'Regards, ' . $_POST['name'] . '.';
$headers = 'From: ' . $_POST['name'] . "\r\n" . 'Reply-To: ' . $_POST['email'] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
if( $_POST['copy'] == 'on' )
{
mail($_POST['email@email.com'], $subject, $message, $headers);
}
}
?>
When i click "SEND" on my contact form it goes to a blank page, however I do recieve the email. What's wrong?
Thanks a lot.
Carl
Website
http://www.vrijeme-reklame.net
Contact form blank page
http://www.vrijeme-reklame.net/demo-contacts.php
Error message:
[Wed Mar 16 15:58:34.846118 2016] [lsapi:error] [pid 220778] [client 94.253.149.34:56523] mod_lsapi: [host www.vrijeme-reklame.net] [req POST /demo-contacts.php HTTP/1.1]: Could not stat script filename (/home/vrijemer/public_html/demo-contacts.php): errno 2, referer: http://www.vrijeme-reklame.net/
The problem is your demo-contact.php
does not print anything. Try adding some echo
statement and it will not show blank page.instead it will print those echo statement.
Other thing , you can do is , Try to redirect to some specified url whenever you want. header('Location: http://www.vrijeme-reklame.net/#contact');
Your html page redirects to this php page, which then handles your data according to the code you have written, however, php code is not displayed on the page directly, similarly to javascript. If you would like this page to display information, use echo in your php, or create html tags and put html in those. Alternatively, if you wished to not redirect to this page, and simply allow your php page to handle the code while remaining on the page with the form, google and us jquery and $.ajax
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.