小编use*_*638的帖子

编辑表单以清理/验证电话号码

我对PHP的经验非常有限,我真的希望有人可以帮助我.

我想要做的是清理/验证电话号码输入,以便只允许号码.

我想我需要使用,FILTER_SANITIZE_NUMBER_INT但我不知道在哪里或如何使用它.

这是我的代码:

<?php

// Replace the email address with the one that should receive the contact form inquiries.
define('TO_EMAIL', '########');

$aErrors = array();
$aResults = array();

/* Functions */

function stripslashes_if_required($sContent) {

    if(get_magic_quotes_gpc()) {
        return stripslashes($sContent);
    } else {
        return $sContent;
    }
}

function get_current_url_path() {

    $sPageUrl = "http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    $count = strlen(basename($sPageUrl));
    $sPagePath = substr($sPageUrl,0, -$count);
    return $sPagePath;
}

function output($aErrors = array(), $aResults = array()){ // Output JSON

    $bFormSent = empty($aErrors) ? true : false; …
Run Code Online (Sandbox Code Playgroud)

php forms email filter-var

7
推荐指数
2
解决办法
3万
查看次数

标签 统计

email ×1

filter-var ×1

forms ×1

php ×1