Carlo Posted April 14, 2010 Share Posted April 14, 2010 Hello, hopefully someone can help me with this... I don't know hardly any PHP, but I seem able to hack my way though it to do some modifications. But I'm stuck at a really simple thing. I have a form script in which I want to detect if the email is from a specific domain, for example, "hotmail.com" $email=$_POST['email']; Example: [email protected] I need something in the line of: if {$email contains "hotmail"} echo "you are using a hotmail account" *It's the part of the examining the email for "hotmail" that I cant figure out how to do. I know it's really simple, but I'm trying to learn. Any help would be greatly appreciated, thanks. Link to comment https://forums.phpfreaks.com/topic/198536-if-email-contains-x-then/ Share on other sites More sharing options...
Ken2k7 Posted April 14, 2010 Share Posted April 14, 2010 Read up on strpos. Link to comment https://forums.phpfreaks.com/topic/198536-if-email-contains-x-then/#findComment-1041796 Share on other sites More sharing options...
DWilliams Posted April 14, 2010 Share Posted April 14, 2010 if (strpos($email, '@hotmail.com') !== false) echo "you are using a hotmail account"; Link to comment https://forums.phpfreaks.com/topic/198536-if-email-contains-x-then/#findComment-1041798 Share on other sites More sharing options...
Carlo Posted April 14, 2010 Author Share Posted April 14, 2010 Thanks to both! That was exactly what I needed! Thanks! Link to comment https://forums.phpfreaks.com/topic/198536-if-email-contains-x-then/#findComment-1041887 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.