Go Back   CodingForums.com > Web Projects and Services Marketplace > Web Projects > Small projects (quick fixes and changes)

Notices

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-27-2009, 12:32 PM   PM User | #1
bellinger
New to the CF scene

 
Join Date: Mar 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
bellinger is an unknown quantity at this point
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 -->
bellinger is offline   Reply With Quote
Old 03-27-2009, 12:49 PM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
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
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

Last edited by abduraooft; 03-27-2009 at 05:21 PM..
abduraooft is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:58 AM.


Advertisement
Log in to turn off these ads.