Controlli nel form html e nell'inserimento php
Questo è il form e il file php che uso per salvare i commenti:
Codice HTML:
<form action="ins.php" method=post>
Nome:<br>
<input type="text" name="nome"><br />
Commento:<br>
<textarea name="commento" cols=40 rows=6 maxlength="300"></textarea>
<br /><input type="submit" value="invia" name="invia"></form>
Codice PHP:
<?php
$dateform = date("d/m/Y");
$timeform = date("H:i");
$testo=$_POST['commento'];
$testo= nl2br($testo);
$open = fopen('contatti.txt','a');
fwrite( $open, "\n<hr id='bordi'><p>".$dateform." ".$timeform."</p><br /><h3>".$_POST['nome']." scrive:<h3> <hr /><br /> <p>".$testo."</p><br /><hr id='bordi'>" );
fclose($open);
?>
Volevo sapere, c'è del codice che posso aggiungere all'uno o all'altro per inserire dei controlli tipo, che il messaggio e il nome vengano inseriti e cose così.