可能重複之前:
Please help me VALIDATE Mobile no in php form在PHP中的手機號碼添加前綴,將它發送到數據庫
我的手機號碼來驗證,但我被困在前綴部分。
if(empty($_POST['mobileno'])) // phone number is not empty
{
$error[] = 'Please enter mobile number';
} else {
if(preg_match('/^\d{10}$/',$_POST['mobileno'])) // phone number is valid
{
$mobile = $_POST['mobileno'];
// your other code here
}
else // phone number is not valid
{
$error[] = 'Phone number invalid !';
}
}
$prefix = 0;
$pmobile = $prefix . $mobile;
這就是我想要做的前綴。這是正確的,因爲我不能在數字前加0。
而你遇到的問題是......? – DaveRandom 2012-08-02 22:51:53
這段代碼會發生什麼?有沒有錯誤? – Alfabravo 2012-08-02 22:52:22
手機號碼在哪個國家? – 2012-08-02 22:53:12