Mám problém, môj formulár zobrazuje zle diakritiku (formulár mám stiahnutí z eng stránok)
Tu je kód
PHP
Kód: Vybrať všetko
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "[email protected]";
$email_subject = "Přihláška";
function died($error) {
// your error code can go here
echo "Nastala chyba ve formuláři, který jste vyplnil ";
echo "Vyskytli se chyby:<br /><br />";
echo $error."<br /><br />";
echo "Prosím jdete zpátky a opravte chyby.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['first_name']) ||
!isset($_POST['last_name']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone']) ||
!isset($_POST['comments'])) {
died('Omlouváme se, ale nastal problém s vyplnením formulára.');
}
$first_name = $_POST['first_name']; // not required
$last_name = $_POST['last_name']; // not required
$email_from = $_POST['email']; // required
$telephone = $_POST['telephone']; // not required
$comments = $_POST['comments']; // required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'Emailová adresa je neplatná.<br />';
}
if(strlen($comments) < 2) {
$error_message .= 'Bydlište, které ste zadal je neplatné.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Detaily přihlášky\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Jméno: ".clean_string($first_name)."\n";
$email_message .= "Narozen: ".clean_string($last_name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Telefon: ".clean_string($telephone)."\n";
$email_message .= "Bydlište: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here -->
<?php
}
?>a tu je HTML
Kód: Vybrať všetko
<form name="contactform" method="post" action="send_form_email.php">
<table width="450px">
<tr>
<td valign="top">
<label for="first_name">Jméno *</label>
</td>
<td valign="top">
<input class="input" type="text" name="first_name" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top"">
<label for="last_name">Narozen *</label>
</td>
<td valign="top">
<input class="input" type="text" name="last_name" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="email">Email *</label>
</td>
<td valign="top">
<input class="input" type="text" name="email" maxlength="80" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="telephone">Telefon</label>
</td>
<td valign="top">
<input class="input" type="text" name="telephone" maxlength="30" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="comments">Bydliště *</label>
</td>
<td valign="top">
<textarea class="input" name="comments" maxlength="80" cols="31" rows="2"></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<input class="button2" type="submit" value="Odeslat">
</td>
</tr>
</table>
</form>V html mám v hlavičke <meta charset="utf-8">
Prosím vás vedeli by ste mi s tým pomôcť, že čo mám kde konkrétne dať, aby mi to fungovalo aj s diakritikou?
Jak hovorím som v Php úplny začiatočník, tak budem rád za každého ochotného človeka
Ďakujem