473,396 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Input Box with Masking

ddtpmyra
333 100+
How can you do input mask inside PHP let say I wanted to input a phone number with this format below:

(123) 4756-7890
Jul 15 '09 #1
3 2681
dlite922
1,584 Expert 1GB
There's no mask. What do you mean by input mask?

A phone number is typically a string of numbers. It should be stripped from all other characters when PHP deals with it (ie put in database), only when presented, the presentation programmer should put the number back in the format desired.

Expand|Select|Wrap|Line Numbers
  1.  
  2. $cleanPhone = preg_replace("/[^0-9]/","",$_POST['phone']); 
  3.  
  4.  
Thanks,



Dan
Jul 16 '09 #2
ddtpmyra
333 100+
Hi Dan,

This is for inputing not saving the numbers on the database. Usually users are confused if they need to put dashes and parenthesis on the form.. But to make it uniform I wanted to put this masking on the text box. How can I do this?
Jul 16 '09 #3
Dormilich
8,658 Expert Mod 8TB
@ddtpmyra
since PHP is executed on the server it cannot interact with the user's input. you can use a default value for the input field as "mask" together with some styling. or even a background image seems possible. further enhancements can be applied through Javascript.
Jul 16 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Piotr | last post by:
Please help me, I can't solve this problem: I have domain: www.main_domain.com/index.php?userid=23&parametr1=2&parametr2=3 (and other site files like...
2
by: Ginchy | last post by:
I have uploaded a small 3 page web using MS Publisher 2003 and after uploading I switched on url masking to cloak the url. I am certain that it worked fine. I simply changed the colour scheme...
13
by: Eric Lilja | last post by:
Hello, consider the following complete program: #include <assert.h> #include <ctype.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <time.h> static int...
2
by: Sam | last post by:
Why isn't there a numberBox Windows Form control like a textbox control but for numeric (float) input? There doesn't seem to be any easy or visual solution to this VERY SIMPLE ISSUE in either...
0
by: Dana Epp | last post by:
I have a ToolBarButton that when I set it to disabled (button.Enabled = false;) causes a really ugly gray masking effect to take place. This is normal and the intended way of the button, but I...
3
by: julianmoors | last post by:
Hey, Currently I'm writing a VB.NET/1.1 app and I need to mask the input for the password field. Does anyone know how to do this in VB? I've seen a C# example, but wouldn't know how to convert...
1
by: nbaztec | last post by:
I have made a program to take password from the user and chek if its right or not. There's no problem with it. The only problem i face is to mask the input I know of getpass() but it limits the...
9
by: Daniel Smedegaard Buus | last post by:
Hey all :) I was wondering about the $error_types (I particularly notice the 's' suffix when reading the manual) parameter for 'set_error_handler()': Can be used to mask the triggering of the...
2
by: meghla | last post by:
I can not understand how to implement bit masking on a c code?? while working with array it is taking too much time.................. so i need help. i need some suggestion and sample code of C...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.