/    Sign up×
Community /Pin to ProfileBookmark

PHP Validation Code…

Hi, I’m having trouble with my validation contact form…it’s telling me I have an error here:

}
if($email && !ValidateEmail($email))
{

but I don’t see one, and that line looks right to me…

so the error is on this page:

[url]http://www.dcmedia-design.com/contact-us.html[/url]

Can someone help me?? I’m familiar with PHP, but not an expert by any means…

Thank you!

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogNov 04.2010 — Well, the error says:
Call to undefined function: validateemail()[/quote]
So, where is that function defined? Did you spell it right?
Copy linkTweet thisAlerts:
@DecoughlinauthorNov 04.2010 — It's in another file called "functions" that is a php file to basically Validate my Email. Here is the code:

<?php

function ValidateEmail($email)

{

/*

(Name) Letters, Numbers, Dots, Hyphens and Underscores

(@ sign)

(Domain) (with possible subdomain(s) ).

Contains only letters, numbers, dots and hyphens (up to 255 characters)

(. sign)

(Extension) Letters only (up to 10 (can be increased in the future) characters)

*
/

$regex = '/([a-z0-9_.-]+)'. # name

'@'. # at

'([a-z0-9.-]+){2,255}'. # domain & possibly subdomains

'.'. # period

'([a-z]+){2,10}/i'; # domain extension

if($email == '') {

return false;

}

else {

$eregi = preg_replace($regex, '', $email);

}

return empty($eregi) ? true : false;

}

?>
Copy linkTweet thisAlerts:
@NogDogNov 05.2010 — Did you include() or require() that file within the main script?

PS: If you wrap your code samples here in [noparse][code=php] [/code][/noparse] tags, it will be much easier for us to read.
×

Success!

Help @Decoughlin spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...