Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation Question on masks

Status
Not open for further replies.

shelby55

Technical User
Jun 27, 2003
1,229
CA
Hello

I have web developer creating a webpage using php and accessing an Access database for the tables. Is it not possible to program entry masks so that all entries are the same/correct? For example, forcing the user to enter postal code as ANA NAN and phone numbers (NNN) NNN-NNNN and the spaces, dashes and brackets fill in automatically?

Thanks.

Shelby
 
yes that is possible, but i am a bit confused as to how to format them...

Known is handfull, Unknown is worldfull
 
this should do the trick for you:
Code:
<?php
$phone_no = $_POST['phone_no']; // if posted from a form

$area = substr($phone_no, 0, 3);
$nxt = substr($phone_no, 3, -3);
$lst = substr($phone_no, -3);

echo "($area) $nxt $lst";
?>


Regards,

Martin

Gaming Help And Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top