Jump to content

valitdation address


wenxi

Recommended Posts

just like to ask if this function is workabkle?

 

 

if (!ereg("^[a-zA-Z0-9\]{3,50}$", $_REQUEST['tfaddress']))

{

$adderr = "* Please Enter a valid address name that only contain letter, space and -";

$error++;

}

 

 

for examp my address is "1234 singapore 59 orchard boulevard"

Link to comment
Share on other sites

You have a '\' infront of the ']'. Not correct. Should be a space in between I guess.

 

You sure some adresses arent longer than 50? Btw, I should seperate streetname (with or without house number (can be seperate)), city, province, country, postal code

 

FD

Link to comment
Share on other sites

so what is the code like? If i want to chunk them all up?

 

if (!ereg("^[a-zA-Z0-9-]{3,100}$", $_REQUEST['tfaddress']))

        {

            $adderr = "* Please Enter a valid address name that only contain letter, space and -";

            $error++;

        }

 

Link to comment
Share on other sites

If you wanna validate Urls You can use this

if (preg_match('/(?P<protocol>\w+):\/\/(?P<domain>[-A-Z0-9.]+)(?P<file>\/[-A-Z0-9+&@#\/%=~_|!:,.;]*)?(?P<parameters>\\?[-A-Z0-9+&@#\/%=~_|!:,.;]*)?/i', $url, $m)) {
print_r($m);//Matched
} else {
//Not Matched
}

Hope it helps.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.