I have a contact form on my new website. It is a template I bought back in 2014, so I suspect there m,ight be an upgrade problem (code too old for current version of php on the server). But I do not know enough to find the problem. The php version on the server is 8.1
I don´t get any errors. Just nothing happens when I press send
The website is www.rytmekraft.no
The html code is:
<form id="contact-form" class="checkform" action="#" target="contact-send.php" method="post" >
<div class="form-row clearfix">
<label for="name" class="req">Navn *</label>
<div class="form-value"><input type="text" name="name" class="name" id="name" value="" /></div>
</div>
<div class="form-row clearfix">
<label for="name" class="req">Firma *</label>
<div class="form-value"><input type="text" name="name" class="name" id="name" value="" /></div>
</div>
<div class="form-row clearfix">
<label for="email" class="req">Epost *</label>
<div class="form-value"><input type="text" name="email" class="email" id="email" value="" /></div>
</div>
<div class="form-row clearfix textbox">
<label for="message" class="req">Melding *</label>
<div class="form-value"><textarea name="message" class="message" id="message" rows="15" cols="50"></textarea></div>
</div>
<div id="form-note">
<div class="alert alert-error">
<h6><strong>Error</strong>: Please check your entries!</h6>
</div>
</div>
<div class="form-row form-submit">
<input type="submit" name="submit_form" class="submit" value="Send" />
</div>
<input type="hidden" name="subject" value="RytmeKraft kontaktform" />
<input type="hidden" name="fields" value="name,email,message," />
<input type="hidden" name="sendto" value="[email protected]" />
</form> type or paste code here
The php document code is:
<?php
define("[email protected]", $_POST['sendto']);
if (WEBMASTER_EMAIL == '' || WEBMASTER_EMAIL == 'Testemail') {
die('<div class="alert alert-confirm"> <h6><strong>The recipient email is not correct</strong></h6></div>');
}
define("EMAIL_SUBJECT", $_POST['subject']);
if (EMAIL_SUBJECT == '' || EMAIL_SUBJECT == 'Subject') {
define("EMAIL_SUBJECT",'Contact');
}
$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$message = stripslashes($_POST['message']);
$custom = $_POST['fields'];
$custom = substr($custom, 0, -1);
$custom = explode(',', $custom);
$message_addition = '';
foreach ($custom as $c) {
if ($c !== 'name' && $c !== 'email' && $c !== 'message' && $c !== 'subject') {
$message_addition .= '<b>'.$c.'</b>: '.$_POST[$c].'<br />';
}
}
if ($message_addition !== '') {
$message = $message.'<br /><br />'.$message_addition;
}
$message = '<html><body>'.nl2br($message)."</body></html>";
$mail = mail(WEBMASTER_EMAIL, EMAIL_SUBJECT, $message,
"From: ".$name." <".$email.">\r\n"
."Reply-To: ".$email."\r\n"
."X-Mailer: PHP/" . phpversion()
."MIME-Version: 1.0\r\n"
."Content-Type: text/html; charset=utf-8");
if($mail)
{
echo '
<div class="alert alert-confirm">
<h6><strong>Confirm</strong>: Your message has been sent. Thank you!</h6>
</div>
';
}
else
{
echo '
<div class="alert alert-error">
<h6><strong>Error</strong>: Your message has not been send!</h6>
</div>
';
}
?>