bilis_money Posted August 13, 2006 Share Posted August 13, 2006 i'm planning to restrict user input.I want only from character a-z, A-Z, and 0-9.let say i have a TEXT BOX with a name='topic',and $topic_tmp = $_POST['topic'];now i want $topic to accept the allowed character only how?How could i do this on REGEX properly?thanks PHP geeks in advance. Link to comment https://forums.phpfreaks.com/topic/17374-restricting-input-a-z-and-a-z-and-0-9/ Share on other sites More sharing options...
corbin Posted August 13, 2006 Share Posted August 13, 2006 Lolz most people dont take the term geeks in a nice sense.... Anyways, I'm no regex expert (just starting messin with it today) but you could use something like[code=php:0]if (!preg_match("/[a-z0-9]$/i", $topic_tmp)){ die ("incorrect name.");}[/code] Link to comment https://forums.phpfreaks.com/topic/17374-restricting-input-a-z-and-a-z-and-0-9/#findComment-73956 Share on other sites More sharing options...
effigy Posted August 13, 2006 Share Posted August 13, 2006 [tt]/^[a-zA-Z0-9]+$/[/tt] Link to comment https://forums.phpfreaks.com/topic/17374-restricting-input-a-z-and-a-z-and-0-9/#findComment-74117 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.