Page 1 of 1

Restricting a User to enter Valid Data

Posted: Sat Aug 12, 2006 1:35 am
by Kakumanuprince
Hi,

Can you please help me on how to restrict a User to not allow him to enter a other Mail ID's in MSN Mail ID Text box

Thank You

Posted: Sat Aug 12, 2006 2:31 am
by RobertGonzalez
Please explain this a little better.

Re: Restricting a User to enter Valid Data

Posted: Mon Aug 14, 2006 1:24 am
by lohitha
hi
Kakumanuprince wrote:Hi,

Can you please help me on how to restrict a User to not allow him to enter a other Mail ID's in MSN Mail ID Text box

Thank You

Posted: Mon Aug 14, 2006 1:26 am
by RobertGonzalez
How exactly was that helpful? I asked for a better explanation, not a quote of the original post. Thanks.

Restricting a User to enter valid Data

Posted: Mon Aug 14, 2006 1:35 am
by Kakumanuprince
Everah wrote:Please explain this a little better.
Hi,

Thank You for your concern

As You might have seen in the Registration form of this very same forum We have two fields "MSN Messenger" and "Yahoo Messenger" and these fields accept any Mail ID as valid data for ex. if I enter my gmail Acc or Rediff acc. or Sify Acc. in this field, It is accepting as a valid mail ID. Can I restrict the User not to enter such ID's and make him only enter the Hotmail ID in "MSN Messenger" field and Yahoo ID in the "Yahoo Messenger" Field


Thank You

Posted: Mon Aug 14, 2006 1:45 am
by RobertGonzalez

Code: Select all

<?php
if ( !strstr($_POST['mail_id'], 'hotmail.com') )
{
    die('We cannot accept anything other than a hotmail.com email address');
}
?>
Where 'mail_id' is the field from your form.

ANY INFO

Posted: Mon Aug 14, 2006 1:59 am
by lohitha
did u get any replies clarifying the doudt

Re: ANY INFO

Posted: Mon Aug 14, 2006 2:11 am
by RobertGonzalez
lohitha wrote:did u get any replies clarifying the doudt
What? What does this mean?

Posted: Mon Aug 14, 2006 3:51 am
by fastfingertips
I suppose that you would like to force the user to enter same email ID in his contact and also in the MSN messenger field. In this case you should make a double validation, first one on the user side using JavaScript and the second one on server through PHP.

The php validation should look like:

Code: Select all

if(strcasecmp($_POST['user_email'],$_POST['user_email_msn']))
{
      //Error message here
}