Jump to content


Photo

How to add country code after user insert their mobile number

country-code validation mobile

  • Please log in to reply
2 replies to this topic

#1 soundsticks

soundsticks

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 25 March 2013 - 10:26 PM

How to add country code if user doesn't enter the country code when they register? If user did enter the country code it will skip and store it into database, if user doesn't enter then system will add the country code and store to database. How can I do that? 



#2 haku

haku

    Advanced Member

  • Staff Alumni
  • 6,172 posts

Posted 26 March 2013 - 01:37 AM

How do you intended to determine their country code if they don't enter one?



#3 soundsticks

soundsticks

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 27 March 2013 - 12:11 AM

I have done in this way.

if (preg_match('/^01/', $_POST['mobile']))
{
...
}
elseif (preg_match('/^60/', $_POST['mobile'])) 
{
...
}





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com