If I click on Send button, the page disappears

My php mailer script works, the e-mail arrives to my inbox but the form page (and the whole website) disappears when I click on the Send button. Here is my code. Could you help what is wrong? (Sorry, but I’m an absolute beginner and from Hungary, that’s why you can see those characters.)

[php]<?php

$emailSubject = ‘Ajánlatkérés érkezett!’;
$mailto = ‘****@hotmail.com’;

$nameField = $_POST[‘name’];
$phoneField = $_POST[‘phone’];
$emailField = $_POST[‘email’];
$descriptionField = $_POST[‘description’];

$body = <<<EOD




Név: $nameField

Telefon: $phoneField

E-mail: $emailField

Leírás: $descriptionField

EOD;

$headers = “Feladó: $email\r\n”;
$headers .= “Content-type: text/html\r\n”;
$success = mail($mailto, $emailSubject, $body, $headers);

?>[/php]

At least in the code you posted below, there isn’t any return value or markup being sent to the browser… a quick fix might be to add the example below at the bottom (after the $success line):

[php]

$url = ‘http://where.to.go/something’;

header("Location: " . $url);

[/php]

The “header” sends a redirect… maybe set $url to the previous page or something. You could always just add some HTML to the end, maybe also check that $success really is a ‘success’:

[php]
$success = mail($mailto, $emailSubject, $body, $headers);
if ($success !== FALSE) {
echo ‘

Your email to ’ . $mailto . ’ was sent successfully!

’;
} else {
echo ‘

Uh oh… something went wrong while sending the email. Panic!

’;
}
[/php]

Dunno… hopefully some of that helps.

Sponsor our Newsletter | Privacy Policy | Terms of Service