How can I check that a data value is alphanumeric?
However if you don't want to get involved with those or find them confusing, as usual with PHP there is a function lurking around to help you achieve your desired result.
You can easily validate specific to the curernt locale setting with the ctype_alpha function, one of the character type functions added to PHP in version 4.3 which works like this:
<?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.
Comment on this Question and Answer >>>
ASK A QUESTION
More forms PHP Questions
Hi all , I use CURL to login to webtrafficagents.com . I got the script and modified it to login to several sites , but it can't login to this one , any experts can help , a reward is granted :) what i want : I want to be able to view the sourceHow do you check for an empty field in a form?
DYnamic Dropbox when I select a value it has to add a textbox to a specific position in the form how do I do it?? If I could change the dropbox in a textbox and make it add Textboxes depending on the number typed it would be even better but dont think th
How do I know if magic quotes is switched on?
How do I escape data that is going into a database?
