Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Mail Validation

    1)I am using GetResponse as a marketing programme where users submit a name and email address to the server CGI
    I want to validate the email address and only allow ".gov.uk, .org.uk & .ac.uk" extensions.

    2) $30 but needs to be done TODAY

    3) Immediate payment by Paypal

    4) The code in my Html is as follows.

    <!-- GetResponse subscription form | start -->

    <form action="http://www.getresponse.com/cgi-bin/add.cgi" method="post" id="GRSubscribeForm" accept-charset="UTF-8">
    <fieldset>
    <table>


    <tr>
    <td>
    <label for="GRCategory2">Your Name</label>:
    </td>
    <td><input type="text" name="category2" size="14" id="GRCategory2" /></td>
    </tr><tr>
    <td><label for="GRCategory3">Your E-Mail</label>:</td>
    <td><input type="text" name="category3" size="14" id="GRCategory3" /></td>
    </tr>

    </table>
    <input type="submit" value="Join SCNF" />
    </fieldset>
    <input type="hidden" name="category1" value="scnf" />

    <input type="hidden" name="ref" value="000" />
    <input type="hidden" name="getpostdata" value="get" />
    </form>
    <style>
    <!--
    /* form box */
    #GRSubscribeForm fieldset {
    width: 260px;
    border: 0;
    }

    /* comment about GetResponse */
    #GRSubscribeForm p {
    font-size: x-small;
    }

    /* table used to position form elements */
    #GRSubscribeForm table {
    border: 0;
    }

    -->
    </style>
    <!-- GetResponse subscription form | end -->

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    It's as simple as
    PHP Code:
    <?php 
    if(isset($_POST['category3'])){
        
    $Email=trim($_POST['category3']);
        if(empty(
    $Email))
            
    $errors['Email']="Please enter an email";
        else if(!
    eregi("^[[:alnum:]][a-z0-9_.'+-]*@[a-z0-9-]+(gov|org|ac)\.uk$",$Email))
            
    $errors['Email']="Email entered is not valid. It should be ending with .gov.uk, .org.uk or .ac.uk";
    echo     
    $errors['Email'];    
    }

    ?>
    in PHP
    Last edited by abduraooft; 03-27-2009 at 05:21 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •