I have a form which people submit how ever i need to know how to do the following please. People enter their mobile number in the UK so it will be something like 07812345678
Now i need it so the consumer enters it in this format
+447812345678
(Country Code and then the number without the first 0)
How do i code it so when they enter their number i adds 44 at the beginning and removes the first 0 in the variable?
You’ll have to check first to make sure that the first character of the string is a “0.” if it is then you could use str_replace(); to replace it with the +44 (or other country code)
These links may help:
I need some help please, I’ve managed to code it but for some reason its not working correctly.
$mobileno=$_POST['mobileno'];
$findme = '07';
$pos = strpos($mobileno, $findme);
// Note our use of ===. Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos==='0') {
echo "Its At The Beginning!";
} else {
echo "Wrong";
}
If i enter a number that has 07 at the beginning then it still echos Wrong. What have i done wrong?