|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
Special Characters
Hello,
This is a PHP question. I have a html page that people use to input their email addresses to a php page (then into a database). To make sure i dont get any email address that are not valid or if someone types in some other characters by mistake my script will pick the faults. For example, it will allow characters such as '-', '_', '@' but wont allow characters such as '?', '.' and '.' Can anyone point me in the right direction please? Thanks.
__________________
"They have the internet on computers now" - Homer |
|
#2
|
||||
|
||||
|
Search these forums for an email validation script. This question is probably better asked in the PHP forum, too.
![]()
__________________
Jon Sagara "Me fail English? That's unpossible!" |
|
#3
|
|||
|
|||
|
have a read through 'regular expressions' in the manual
|
|
#4
|
|||
|
|||
|
Thank Jon
I've search for it in the forums, i didnt know what it was called. As for putting it in the PHP forum, they would be all snooty at me for asking a simple question like that! They dont realise some of us are not as clever or well educated as they are! And lux, is there a manual? where? ![]() Thanks again. |
|
#5
|
|||
|
|||
|
|
|
#6
|
||||
|
||||
|
Here is a link that covers a regexp about email validation.
http://forums.devshed.com/showthrea...highlight=email Also, I would not disallow the period. One of my addresses have a period in them. A lot of company email addresses are firstname.lastname@company.com You would exclude people like this if you blocked this character. [quote] As for putting it in the PHP forum, they would be all snooty at me for asking a simple question like that! They dont realise some of us are not as clever or well educated as they are! [/quote[ I wouldn't call it being snooty for asking a simple question. What gets a harsh response from most people on this forum is the person showing a lack of preperation or willingness to try and answer his/her own question. In a case like this, simply searching the forum for email, email validation or email update would have returned the appropriate threads for you to search. It would be highly recommended also that you download and read the php manual from www.php.net. That is one of the best manuals that I have seen written and it is fairly informative about the language. |
|
#7
|
|||
|
|||
|
Thanks onslaught! I usually search the threads before i post things, i just didnt know this was called email validation. I was searching for special characters instead
You see i have no language experience whatsoever, no C, java or anything. So for me its like starting from scratch. And i have to say this forum has helped me out alot, i'm not knocking it. Its just that sometimes people expect you to know it all. |
|
#8
|
||||
|
||||
|
I really don't think that the people here expect you to know it all (if you did, you would ask questions
), but I do believe that most of the people here don't want to spoon feed someone. That has a tendancy of wearing on a persons patience just a little.I will agree that sometimes, the people here don't have the best bed-side manner (me included). But on most forums here has a sticky thread posted at the top of each one giving some idea of the general guidelines of the forum. This helps in two ways, 1) it gives you a general set of boundaries to try to stay within to get help from someone and 2) it can help you help yourself solve many problems on your own. Everyone was new to programming at one time or another, and usually patience will be given to those who are new as long as they show some attempt to solve the problem they are having. The two sticky threads at the top of the php forum really states this better than I can, or you can check out the link in my signature (how to ask) which is pretty informative. For the most part, it all boils down to we all have to start somewhere, we gain knowledge through experience, we gain experience through doing. If we do it all for someone, what have they learned? |
|
#9
|
|||
|
|||
|
>> As for putting it in the PHP forum, they would be all snooty at me for asking a simple question like that!
There is no such thing as simple question in Devshed forums. You will never get flamed for asking simple questions (if you search first). But you will definitely get flamed by me if you post message to the wrong forum. This Beginners forum imples to beginner questions only - Where to start and somewhat a catch-all forum. Your topic is clearly a PHP question. With database and special chars involved, that's clearly not a beginner question. Likewise, PHP forum is not a catch-all forum so don't post non-PHP related questions there. Next time you post a question, first start here -> http://forums.devshed.com/showthrea...24097&forumid=5 |
|
#10
|
||||
|
||||
|
A good place to start is to either buy a good book or to grab some free tutorials which the web is full of. I personally find it easier to start a new language with books, and my first PHP book was PHP Fast & Easy Web Development, by Julie Meloni. It's a good book to start with. For tutorials, you can start from PHPbuilder and Zend. The best source of information, yet, is the official PHP manual (like stated before).
__________________
-- Tomi Kaistila -- Developer's Journal The more you learn, the more you know. The more you know, the more you forget. The more you forget, the less you know. |
|
#11
|
||||
|
||||
|
some snippets
Here are some snippets to get you started: It's dead basic, but a starting point. You could also write some client-side validation in javascript. (js uses PERL regular expressions, so it would be pretty much the same)..
this test will check that the email field on your form is set. If it isn't, you can add code to tell the user to enter one if((!isset ($email))||$email==""){ echo "<b>too bad - no email</b>"; and then this test will look for some something that looks like an email address - id, something followed by an @ followed by something followed by a dot, followed by something }elseif(!ereg("^.+@.+\..+$", $email)){ echo "<b>try that again!<b>"; and this test will check for illegal characters... ][<>,;:\/" }elseif(ereg("[][(),;:\"\/]", $email)){ echo "<b>invalid chars in address<b>"; }else{ //get on with the email bit } hope that's a start for you, Christo ![]()
__________________
. Spiration channels: Free scripts, programming tutorials and articles Dotcut alerts: Online Press cuttings / news alerts Clearprop: UK microlight school, wiltshire Uk dating: UK safe dating with Topdates About Christo . . |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > Special Characters |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|