Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

need help on boardsearch please


dahui

Recommended Posts

Posted

my english is limited and I am quite sure to find awnsers here but all my seraches result into 0 results

 

I want to know how to check thecontent offromfield for concitencies like phonenumbers has no other than

 

1234567890 () +. /

 

I searched for many combinations of

form

formfield

inputfield

validate

verify

verifcation

check

.

.

.

 

:blink: :blush: :huh:

 

please point me in right direction

 

thx dahui

Posted

hello mike try the ereg like this

 

if (ereg ("[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]", $tel_number) != 1 ) {

// invalid number

}

 

but you need to handle the other cases with area code,-, etc. (This is for 10 digit numbers)

Posted
NOBODY ???  <_<

 

don't you care if someone e.g. enters "sh21fg132sdhgd1" as phone-number ???

 

dahui

 

In the U.S. that could be a valid number. :P

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Posted
hello mike try the ereg like this

 

if (ereg ("[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]", $tel_number) != 1 ) {

  // invalid number

}

 

but you need to handle the other cases with area code,-, etc. (This is for 10 digit numbers)

 

hi mark

 

thy for yr input

 

if I do unerstand I can use this ereg (is it a function?) for all the inputfileds to be validated?

 

some more qusetions arise ;)

 

when I define like you did explain, would that mean a 9 digit number would be invalid?

 

and a lot more, so the master question

where can i find more informaion on howto use ereg?

 

thx dahui

 

search ereg on broad bings 390 ++ with :blush:

Posted

ok, a bit further in my knowledge but not satisfied yet ;)

 

e.g.

(ereg ("([0-9]{5})/([0-9]{12})", $tel_number) != 1 ) {
 // invalid number
}

would that validate any fone as valid if

[prefix 1-5 digits long consisting only of 0-9]/[number 1-12 digits long consisting only of 0-9] ???

like

1/123456789012

12345/1

 

but what is whith extensions like

1234/123456789-78

 

they will be errored, right?

 

further I found in the above link e.g. this

if (ereg("[^[:space:]a-zA-Z0-9_.-\\']", $string))

to validate a Name, but I cannot read it

 

any process rather than implement and trial and error for ereg's to be checked?

 

or even more basic:

 

how do you folks out there handle this on your live carts, or do I have a completely wring appoach to this issue?

 

dahui

Posted

mike you can place a hyphen for optional digits like extension etc like

 

if(ereg("^[0-9]{10}(-[0-9]{4})$",$tel_number) != 1 {

// Invalid number

}

 

so this will require 10 digit number and 4 digit optional extension with a - in between

 

for real names use the a-zA-Z latin characters validatio check.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...