![]() |
IOBit Software
|
|
|
||||||
| Programming Place to discuss programming including HTML, Java, C++, MySQL and others. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
If a user enters more than one email address in a form field, what's best way to only allow the first one?
I thought about using explode, but the code I came up with seems rather inefficient, because the user may enter the data with "comma" between the addresses, or with "semicolon" between the addresses, and with or without whitespace between the addresses. Suggestions greatly appreciated. Thanks! |
| Sponsored links |
|
|
|
#2
|
||||
|
||||
|
I'm thinking maybe accept the input and then look to see where the first space, comma, semicolon, etc. occurs and then take the substring from the beginning until just before that spot?
|
|
#3
|
||||
|
||||
|
Thanks for your response.
What you suggest is pretty much what I'm doing, except it takes me 4 lines of code (I've barely scratched the surface of PHP, so have a LOT to learn yet). Was thinking there's probably a better way. |
|
#4
|
||||
|
||||
|
I don't know of any other way, but that doesn't mean there isn't. You could use dropdown boxes for the .com,.net,.org, but now with the proliferation of top level domains with email addresses, it may be hard to keep the list updated. But that is a surefire way to limit them to one address.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Saving strings as csv files in VB6 | ceal21c | Programming | 2 | 05-25-06 19:48 |
| VBA Strings | BMD | Programming | 2 | 01-19-06 13:55 |
| vb6 Saving Strings and Integers | mastermosley | Programming | 15 | 10-26-05 20:42 |
| Symantec Multiple Products UPX Parsing Engine Buffer Overflow | NICK ADSL UK | Virus Software Updates (Read Only) | 0 | 02-10-05 15:31 |
| Bending Strings | BluesMan | Interesting Website Links | 4 | 07-30-04 02:23 |