PHP Questions Home
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

How can I check that a data value is alphanumeric?


There are various ways to do this, and people commonly do this with a regular expression of some description.

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.



ASK A QUESTION

More forms PHP Questions

i just wanted to put a textbox beside the query of the evaluation form. how can i do that? ========================== here is my php form index.php PERFORMANCE APPRAISAL INSTRUMENT var Event = { add: function(obj,type,fn) {

Hello, I an trying to figure out how to pass a variable email address to the contact form where you see the send-to-me@me.com. My contact page In a php file uses the following iframe embed: The contact script in feedback/contact. php

how to display like table from database records?

How do I know if magic quotes is switched on?

PHP program to register students' record



Custom Search