International Mobile Numbers

15 posts by 3 authors in: Forums > CMS Builder
Last Post: January 31, 2011   (RSS)

By Toledoh - January 28, 2011

HI Jason,

Attached is the profile.php

It's making sure the input is correct (ie. starts with 04) but doesn't convert it to the international format.

NB. The is an error on this file re membership checkboxes - but that's another discussion)

Cheers,
Tim
Cheers,

Tim (toledoh.com.au)
Attachments:

profile_006.php 10K

Re: [Toledoh] International Mobile Numbers

By Jason - January 28, 2011

Hi Tim,

There was a small error in the function, try replacing it with this:

// Mobile Number Format
function format_mobile_number($mobile){
//strip out spaces
$mobile = str_replace(" ","",$mobile);
$tmpPhone = str_split($mobile);

if(@$tmpPhone[1]==4){

$tmpPhone[0]=61;
$phone=implode($tmpPhone);
}
else{
//error
return false;
}
return $phone;
}


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Toledoh - January 28, 2011

Almost there.

I think the final
return $phone; is meant to be return $mobile;

But now, the error checking to make sure it starts with "04" causes an error because its now starting with "614"

Should I keep the $phone and add it to a separate field in the database? use $mobile for display )in the local format of 0411..." and keep the $phone for use with SMS function? or change the error check to check for "04" OR "614"?

Thanks for this Jason - I know its beyond the call of duty!
Cheers,

Tim (toledoh.com.au)

By Toledoh - January 31, 2011

Woo Hoo!

Thanks!
Cheers,

Tim (toledoh.com.au)