Witam, mam utworzony formularz w php. Wszystko ładnie chodzi, oprócz sprawdzania walidacji poprawnego wpisywania adresu email...Podaję kod php mojego formularza:
<?php
////////// USTAWIENIA //////////
$email = 'test@gmail.com'; // Adres e-mail adresata
$subject = 'temat'; // Temat listu
$charset = 'utf-8'; // 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) {
for ($i = 0; $i < count($value); $i++) { }
}
else
}
$message = 'Wiadomość wysłana pomyślnie';
} else {
$error = 'Błąd wysyłania wiadomości';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta charset="utf-8" />
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
Remove this if you use the .htaccess -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>strona glowna</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<?php
echo '<div class="info">' . $message . '</div>'; } else if (isset($error)) { echo '<div class="error">' . $error. '</div>'; }
?>
<div id="runda">
<img src="img/top_bg.gif" alt="top" /><div id="main" class="container">
<h1>Pracownia Projektowa</h1>
<h2>bromboszcz-architekci.pl</h2>
<ul id="navigation">
<li><a href="index.html">O firmie</a></li>
<li><a href="oferta.html">Oferta</a></li>
<li><a href="gallery3/index.php">Projekty</a></li>
<li><a href="mapa.html">Dojazd</a></li>
<li><a href="kontakt.php">Kontakt</a></li>
<li><img id="loading" src="img/ajax_load.gif" alt="loading" /></li>
</ul>
<div class="clear"></div>
<div id="zawartoscstrony"><p class="text">W celu skontaktowania się z nami można także uzupełnic poniższy formularz, skontaktujemy się z państwem najszybciej jak to będzie możliwe. </p>
<br/>
<form id="formularz" action="
<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
<fieldset>
<legend>Formularz</legend>
<label for="imie">Imię i nazwisko:</label>
<div><input type="text" min="3" maxlength="25" required/></div>
<div class="height_10"> </div>
<label for="email">Adres e-mail:</label>
<div><input id="email" name="email" type="text" required="required"/></div>
<div class="height_10"> </div>
<label for="content">Treść wiadomości:</label>
<div><textarea id="content" cols="20" name="content" rows="5" > </textarea> </div>
<div class="height_10"> </div>
<input class="submit" type="submit" value="Wyślij"/>
</fieldset>
</div>
</div>
<div class="clear"></div>
<img src="img/bottom_bg.gif" alt="bottom" /></div>
</div>
</div>
<div align="center" class="stopka">
Copyright by: <a href="http://bromboszcz-architekci.pl" target="_blank">dombroszcz-architekci.pl</a> Pracownia Projektowa</div>
</body>
</html>
W jaki sposób można dodać walidację adresu email do tego formularza php. ? Czy trzeba od nowa przebudować cały plik .php Pozdrawiam serdecznie