Suppose that I have a login page where users need to enter their email addresses. The email addresses will only have a .edu domain name extension.

I was wondering if there was a way for me to figure out what college the user went to based on his/her email address? I know the manual way is to simply copy/paste the ending of their email address. For example: Jsmith10@mit.edu - I would manually type the 'mit.edu' into the URL address bar and figure out what school it is.

However, this is very arduous, and there are 2000 colleges in the USA. I'm more interested in a user experience like this:
EMAIL:

user types in "mary_fuller@emsc.edu"

COLLEGE: populates automatically with: Eastern Mississippi State College

Recommended Answers

All 4 Replies

What you're looking at is a good bit of JavaScript work. You'll need to trim the string from the '@' part, and put the rest, to rest. I really don't know how you are going to find the name of the college exactly, though you can always create a database and then refer towards it using a server-side language/script. You might find the trim() function in JS pretty useful. This forum is not for this post, though :P

Try posting in the JavaScript or PHP forum. AJAX is your friend here, too. Plus, I recommend w3schools.com

@Dantinkakkar,

I'm looking into w3schools right now.

What you're looking at is a good bit of JavaScript work. You'll need to trim the string from the '@' part, and put the rest, to rest. I really don't know how you are going to find the name of the college exactly, though you can always create a database and then refer towards it using a server-side language/script. You might find the trim() function in JS pretty useful. This forum is not for this post, though :P

Try posting in the JavaScript or PHP forum. AJAX is your friend here, too. Plus, I recommend w3schools.com

I would just like to point out that,

Since JavaScript doesn't include a trim method natively,[..]

here is a little research towards finding the most efficient approach to implementing it in a library.

http://blog.stevenlevithan.com/archives/faster-trim-javascript

but he won't need to trim, he will need to split ;)

and yes the database is probably the best route to go for this, unless there is some kind of governement site that offers a webservice you could use to querry the answer from their constantly updated database. Otherwise, its all about your database with your responsability to update it, even if colleges probably don't close or open everyday it will still need updating eventualy!

regex.

you should be able to write a regex function taking everything between
@ and .edu

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.