close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Validate email field against database records

Thread began 8/15/2012 9:41 am by info4753 | Last modified 8/17/2012 3:11 am by info4753 | 771 views | 6 replies

Jason ByrnesWebAssist

ok, you will need to create a recordset to return the allowed domains. After the recordset code, add the following code to loop through it and create a new variable that contains a pipe separated list of domains:

php:
<?php 

$okDomains 
"";
do {
    
$okDomains .= $row_recordsetName['domainName']."|";
} while (
$row_recordsetName mysql_fetch_assoc($recordsetName)); 
$okDomains substr_replace($okDomains,"",-1);
?>




when you add the regular expression validation it will create a line similar to this:

php:
$WAFV_Errors .= WAValidateRX(((isset($_POST["emailField"]))?$_POST["emailField"]:"") . "","/^[A-Z0-9._%-]+@(apple.com|ibm.com|webassist.com)$/i",true,1);



edit that to use the $okDomains variable instead of the static listing of domains:

php:
$WAFV_Errors .= WAValidateRX(((isset($_POST["emailField"]))?$_POST["emailField"]:"") . "","/^[A-Z0-9._%-]+@(".$okDomains.")$/i",true,1);




make sure that the code order is correct, the validation may be placed before the recordset. The order needs to be:
-recordset
-do to create the $okDomains variable
-Validation

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...