Witam, mam problem z formularzem kontaktowym, includuje plik "kontakt.php" do głównego pliku index.php (index.php?id=kontakt.php), problem jest w tym, że wszystkie pola formularza są nieaktywne. Gdzie robię błąd, czy przesyłanie formularza w ten sposób jest błędne?
Fragment includowanie w index.php
<?php
if($_GET['id']=="kontakt") {
include("kontakt.php");
}
elseif ($_GET['id']=="uslugi"){
include("uslugi.php");
}
else{
include("main.php");
}
?>
plik kontakt.php
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "pastucha.lukasz@gmail.com";
$email_subject = "Biuro rachunkowe \"Kaja\"";
function died($error)
{
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error . "<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; }
// validation expected data exists
if (
!isset($_POST['email']) || !isset($_POST['comments']) ) {
died('Proszę wypełnić wszystkie pola');
}
$email_from = $_POST['email']; // required
$comments = $_POST['comments']; // required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
$error_message .= 'Niepoprawny e-mail<br />';
}
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if (strlen($error_message) > 0
) { died($error_message);
}
function clean_string($string)
{
$bad = array("content-type", "bcc:", "to:", "cc:", "href"); }
$email_message .= "Email: " . clean_string($email_from) . "\n";
$email_message .= " " . clean_string($comments) . "\n";
// create email headers
$headers = 'From: ' . $email_from . "\r\n" .
'Reply-To: ' . $email_from . "\r\n" .
@mail($email_to, $email_subject, $email_message, $headers);
}
?>
<div class="dane_kontaktowe"> Biuro rachunkowe "Kaja"
<br> 66-100 Sulechów
<span><img src="ico/e_mail_ico.png">wajlerkielka@wp.pl
</span>
<div class="contact_form"> <form name="contactform" method="post" action="kontakt.php"> <input type="text" class="wpis" name="email" id="email" /> <div id="iemail" class="error"></div> <textarea class="message" name="comments" id="message">
<div id="imessage" class="error"></div> <input name="submit" type="submit" class="button" value="Wyślij" id="submit"/>