A simple method of validation. This is good if you dont want spaces between caracters:
form.php
<FORM action="vali.php" method="post"> <P> <LABEL for="user">User name: </LABEL> <INPUT type="text" id="user"><BR> <INPUT type="submit" value="Send"> </P></FORM>
vali.php
<?php$user =$_POST['user']; $cuser=0;for($i=0; $i<strlen($user); $i++) { if ($user[$i]==" ") { $cuser=1; } } if($cuser==1){ echo "The user name have spaces";}else{ echo "The user name is correct";}?>
Notice from rvalkass:
Remember, all code must be placed in CODE BB tags. Thank you.