处理要输入的最小字符并清除刷新数据 [英] work on minimum characters to be entered and clearing data on refresh

查看:61
本文介绍了处理要输入的最小字符并清除刷新数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?php
//$strVal = getInput("Please input a phone number : ");
echo"Please Enter Numbers Between 5-18 digits";
$strVal =$_GET["number"];
if (isset($strVal)) {
    $l = strlen($strVal);
    $strPhone = substr($strVal, $l, ($l - 4)) ."****";
    $NumberPrefix = substr($strVal, 0, ($l - 4));
    echo "<br />\n";
    echo "Masked Number is : ". $NumberPrefix.$strPhone;
}
 

 
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simple PHP Form Demo</title>
</head>
<body>
  <form id="number" method="get" action="">
   <p><label>number: <br />
    <input type="text"  name="number" class="textfield" value="<?php echo htmlentities($NumberPrefix.$strPhone ); ?>" maxlength="18"/>
    </label></p>
 
    <p><input type="submit" name="submit" class="button" value="Submit" /></p>
    <script>document.form.reset();</script>
  </form>
 

</body>
</html>











以上是我的代码输入电话号码并显示相同号码。但是我需要帮助的两件事是

1.如何在刷新浏览器时清除数据(由用户在文本区域和echo语句中输入)

2.如何将最小数字限制为5



请帮助人....






above is my code to enter a telephone no and display same no. but masked.now two things that i need help with are
1.how to clear the data (entered by user in text area as well as on that echo statement) on refresh of browser
2.how to limit the minimum digits to 5

pls help guys....

推荐答案

strVal = getInput(请输入电话号码:);
echo请输入5-18位之间的数字;
strVal = getInput("Please input a phone number : "); echo"Please Enter Numbers Between 5-18 digits";


strVal =


_GET [number];
if(isset(
_GET["number"]; if (isset(


这篇关于处理要输入的最小字符并清除刷新数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆