<script type="text/javascript"> function hide(x){x.value=''} </script> <script type="text/javascript"> function error(tekst) { if (errfound) return; errfound = true;} function validate(id) { errfound = false; var errors = ""; if (document.getElementById('description').value == ""){errors += "description is empty. \n";document.getElementById('description').style.backgroundColor = "#FFDFDF";} else {document.getElementById('description').style.backgroundColor = "#b9fdbb";} if (document.getElementById('mail').value == ""){errors += "description is empty. \n";document.getElementById('mail').style.backgroundColor = "#FFDFDF";} else {document.getElementById('mail').style.backgroundColor = "#b9fdbb";} if (errors != "") error(errors); return !errfound;} </script> <input type="text" class="textinput" name="mail" id="mail" onfocus="hide(this)" value="Twój e-mail" />
W PHP sprawdzenie robię tak:
<?php $tekst = 'jakiś tekst zawierający.'; ?>