top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

In PHP,How can I check that a data value is alphanumeric ?

0 votes
378 views
In PHP,How can I check that a data value is alphanumeric ?
posted Jun 12, 2014 by Amritpal Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

You can easily validate with the help of ctype_alpha function.
<?php $formvalue = "am I alphanumeric or not"; if(ctype_alpha($formvalue)) { echo "Yes I am!"; } else { echo "No I'm not!"; } ?>

In this case printing "No I'm not!" because $formvalue contains spaces.

answer Jun 13, 2014 by Karamjeet Singh
...