Fix first four numbers in textbox PHP
I want to restrict first four number in textbox in PHP, Here's my sample code开发者_JAVA百科:
<label>Number </label>
<input name="phone" type="text" class="required" id="phone" value="<?=$phone_number?>" maxlength="11" />
Anyone can help?
Like this...
$phone_number = '0116' . $_POST['phonenumber'];
This can be the same
<label>Number </label>
<input name="phone" type="text" class="required" id="phone" value="?=$phone_number?>" maxlength="11" />
Whereever you use the phone number add the digits you want via php.
<label>Number </label>
<input name="phone" type="text" class="required" id="phone" value="1234<?=$phone_number?>" maxlength="11" />
精彩评论