Make name field consist of more than 5 character else echo PHP

Talinka

New Member
I have this code for my forms to let the users know that the min characters should be 5 or more if not they get a error "Name must be more than 5 characters". I have it in javascript but I want to coded it in php too. How can I do that. \[code\]<script type="text/javascript"> // <![CDATA[ function testing(val,x){ maxlen = x; if(val.length > maxlen) { alert('Limit of characters is '+ maxlen); document.chars.tests.value = http://stackoverflow.com/questions/14515132/val.substring(0,maxlen); } } function Minimum(obj,min){ if (obj.value.length<min) alert('min of '+min); } // ]]> </script><form method="post" action="" name="form_2"> <p> <input type="text" name="box1" size="30" onblur="testing(this.value,25);Minimum(this,4);" onkeypress="testing(this.value,25)" /> <input type="submit" value="http://stackoverflow.com/questions/14515132/Submit" name="Button" /> </p> </form>\[/code\]
 
Back
Top