Witam,
Mam problem ze swoim formularzem ze strony. Jak wypełnie wszystkie rubryki i captach niby wszystko jest ok a jednak mail nie dociera.
Drugim progblemem jest w momencie jak nie mam wypełnionych obowiązkowych pól i naciskam submit wiedy pokazują mi się brakujące pola, ale wypełnione znikają i trzeba wszystko wpisywć ponownie..
Bardzo proszę o pomoc.
Oto kody poszczególnych plików:
process.php
<?php
if(empty($_POST['submit'])){ ?>
<?php
}elseif(!empty($_POST['imienazwisko']) && !empty($_POST['email']) && !empty($_POST['trescwiadomosci'])){ /* Funkcja sprawdzajaca poprawnosc E-Maila */
function SprawdzEmail($email) {
if (!eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$" , $email)){ return false;
}
return true;
}
if(SprawdzEmail($_POST['email'])){
/* Tworzymy szkielet wysylanej wiadomosci */
$adresemail="gtc@gtc.pl";
$ip=$_SERVER['gtc.pl'];
$host=gethostbyaddr($_SERVER['gtc.pl']);
$wiadomosc="Od: $_POST[imienazwisko] ($_POST[email])\nIP: $ip, HOST: $host\n\n$_POST[trescwiadomosci]";
$nadawca="From: $_POST[email]";
@mail($adresemail, "Formularz kontaktowy", "$wiadomosc", "$nadawca") or
die('Formularz nie zostal wyslany'); echo "Dziekujemy, formularz zostal wyslany."; }else{ echo "Wprowadzony adres E-Mail jest niepoprawny"; } }else{ echo "Wypelnij wszystkie pola formularza"; } ?>
form.php
<?php
if (count($_POST))
{
////////// USTAWIENIA //////////
$email = 'zapytanie@gtc.pl'; // Adres e-mail adresata
$subject = 'WWW FORM'; // Temat listu
$message = 'Thank you for this message!'; // Komunikat
$error = 'Wystąpił błąd podczas wysyłania formularza'; // Komunikat błędu
$charset = 'iso-8859-2'; // Strona kodowa
//////////////////////////////
$head =
"MIME-Version: 1.0\r\n" .
"Content-Type: text/plain; charset=$charset\r\n" .
"Content-Transfer-Encoding: 8bit";
$body = '';
foreach ($_POST as $name => $value)
{
if (is_array($value))
{
for ($i = 0; $i < count($value); $i++)
{
$body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value[$i]) : $value[$i]) . "\r\n";
}
}
else $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value) : $value) . "\r\n";
}
echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error;
}
else
{
?>
<form id="formularz" method="post" action="process.php"> <div class="field-label"> <div class="field-widget"> <input name="COMPANY" id="field1-t2" class="required" title="Enter your company name. This is a required field" /> <div class="field-label"> <div class="field-widget"> <input name="FIRSTNAME" id="field2-t2" class="required" title="Enter your Firstname. This is a required field" /> <div class="field-label"> <div class="field-widget"> <input name="SURNAME" id="field3-t2" class="required" title="Enter your Surname. This is a required field" /> <div class="field-label"> <div class="field-widget"> <input name="E-MAIL" id="field4-t2" class="required validate-email" title="Please enter a valid email address. For example gtc@gtc.pl" /> <div class="field-label"> <div class="field-widget"> <input name="TELEPHONE" id="field5-t2" class="required validate-number" title="Please enter a valid Telephone number. Please enter a valid number in this field" /> <div class="field-label"> <div class="field-widget"> <Input name="ADDRESS" id="field6-t2" class="validate-number validation-passed" title="Optional: Please enter a valid Address." /> <div class="field-label"> <div class="field-widget"> <input name="ZIPCODE" id="field7-t2" class="validate-number validation-passed" title="Optional: Please enter a valid Zipcode. Please use only numbers." /> <div class="field-label"> <div class="field-widget"> <input name="CITY" id="field8-t2" class="validation-passed" title="Please enter a name of City." /> <div class="field-label"> <div class="field-widget"> <input name="COUNTRY" id="field9-t2" class="validation-passed" title="Please enter a name of Country." /> <div class="opisy" id="personal_data"> <div class="field-label"> <div class="field-widget"> <input name="SUBJECT" id="field10-t2" class="validation-passed" title="Please enter a name of Subject." /> <div class="field-label"> <div class="field-widget"> <textarea name="CONTENT" cols="50" class="required" id="field11-t2" title="Please enter a name of Content. "></textarea> <div class="captach"> <img src="image.php" border="0"><br/> <input type="text" name="image"> <input type="submit" class="submit" value="Submit" /> <input type="button" value="Refresh" onClick="window.location.reload()"> <script type="text/javascript"> var valid = new Validation('formularz', {useTitles:true})
<script type="text/javascript"> new Fabtabs('tabs');
<?php
}
?>
Powód edycji: [thek]: Nie ten dział (proste pytania do Przedszkola) a bbcode typu [php] czy [html] nie wstawiamy dodatkowo w [code].