FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Email Validation or Confirm Email
#3
(Apr 16th, 2016, 7:27 AM)jpmd Wrote: Yes, I would like that too!

Validation Rules will do that.  I'm doing that exact thing on my form.  It is external however, so I'm not sure what your using.

PHP Code:
<?php
require_once("/path/to/formtool/global/api/api.php");
$fields ft_api_init_form_page(2);

// validation time!
$errors = array();
if (isset(
$_POST['sbmt']))
 
    {
 
   $rules = array();
 
    $rules[] = "valid_email,emailaddress,Please enter a valid email address.";
 
    $rules[] = "same_as,emailaddress,emailaddress2,Please insure your confirmation email is the same.";
 
    $errors validate_fields($_POST$rules);
 
   
// no errors - great! Now we process the page. The ft_api_process_form does
// the job of both updating the database and redirecting to the next page
 
   if (empty($errors))
 
        {
 
       $params = array(
 
           "submit_button" => "sbmt",
 
            "next_page" => "https://www.xxx.com/wp/thank-you/",
 
            "form_data" => $_POST,
 
            "finalize" => true
            
);
 
        ft_api_process_form($params);
 
        
// it failed validation. Update $fields with the latest contents of the form data
 
   else
         
{
 
       $fields array_merge($_SESSION["form_tools_form"], $_POST);
 
        
 
   
?>

Then in my form, I have this for the 2 email fields to compare.

PHP Code:
     <tr>
 
       <td align="right" valign="top" width="35%">Email Address<br>
 
       </td>
 
       <td valign="top" width="618"><input maxlength="40" size="40" type="text" name="emailaddress" value="<?=@$fields["emailaddress"]?>" /> *-Required</td>
 
     </tr>
     
  <tr>
 
       <td align="right" valign="top" width="35%">Confirm Email Address<br>
 
       </td>
 
       <td valign="top" width="618"><input maxlength="40" size="40" type="text" name="emailaddress2" value="<?=@$fields["emailaddress2"]?>" /> *-Required</td>
 
     </tr

Hope this helps.

Lyle
Reply


Messages In This Thread
Email Validation or Confirm Email - by Darkfx - Jun 26th, 2015, 3:43 AM
RE: Email Validation or Confirm Email - by jpmd - Apr 16th, 2016, 7:27 AM
RE: Email Validation or Confirm Email - by ocbroadband - Nov 2nd, 2017, 6:52 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)