2 Replies - 358 Views - Last Post: 12 September 2012 - 10:26 PM Rate Topic: -----

#1 richienuez  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-September 12

accept only letter in php

Posted 12 September 2012 - 07:51 PM

hello i am new in php i am trying to create a simple registration form but i cant filter my text box all i want is accept only letters
Is This A Good Question/Topic? 0
  • +

Replies To: accept only letter in php

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2923
  • View blog
  • Posts: 10,106
  • Joined: 08-August 08

Re: accept only letter in php

Posted 12 September 2012 - 07:56 PM

What have you tried?
Was This Post Helpful? 0
  • +
  • -

#3 StefanOnRails  Icon User is offline

  • D.I.C Head

Reputation: 35
  • View blog
  • Posts: 105
  • Joined: 31-July 12

Re: accept only letter in php

Posted 12 September 2012 - 10:26 PM

View Postrichienuez, on 13 September 2012 - 04:51 AM, said:

hello i am new in php i am trying to create a simple registration form but i cant filter my text box all i want is accept only letters

You can filter your input using regex:
if(preg_match('/^[a-zA-Z]+$/',$your_input)){...}
Maybe you should check this article called 15 PHP regular expressions for web developers.

Edit: Apparently the link won't work because somehow <b></b> is added in the page URL, just remove it in order to view the article

This post has been edited by StefanOnRails: 12 September 2012 - 10:33 PM

Was This Post Helpful? 3
  • +
  • -

Page 1 of 1