...

PHP Mail Validation

bellinger
03-27-2009, 12:32 PM
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 -->

abduraooft
03-27-2009, 12:49 PM
It's as simple as <?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 :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum