Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8175559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:49:43+00:00 2026-06-06T22:49:43+00:00

I made a little PHP script that checks if an email is valid. The

  • 0

I made a little PHP script that checks if an email is valid.
The only problem is that it doesn’t check if the dot is BEHIND the ‘@’. It accept emails like this: Hi.Hello@hotmailcom when it should only accept emails like HiHello@hotmail.com

This is my script:

<?php
$mail = $_POST['mail'];

    function checkmail($mail)
        {
            if ((strpos ($mail, '@') !== false) && (strpos ($mail, ".") !==false))
            {                   
                return true;
            }
            else
            {
                return false;
            }
        }

if(checkmail($mail))    
{
echo"Goed"; 
}   
else    
{       
echo"Fout";     
}

?>

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:49:44+00:00Added an answer on June 6, 2026 at 10:49 pm

    Don’t badly reinvent the wheel, use filter_var('bob@example.com', FILTER_VALIDATE_EMAIL), or in your case better filter_input(INPUT_POST, 'mail',
    FILTER_VALIDATE_EMAIL)
    .

    http://php.net/filter_var
    http://php.net/filter_input

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a little script that send a textarea content to PHP page with
Im having a little trouble with a php script ive made. you can see
Ok, so I have this PHP script that runs in a nice little infinite
I've made a little function that sends data from two forms to a PHP
I have a PHP web application where I've made a little module system, that
So... I have some little flash graphs I made that pull data from an
I'm a little new at PHP, so my script writing is still progressing. I
I have made a little framework for php. In this project I have the
I have just made my first proper little desktop GUI application that basically wraps
i've made a little script to calculate prime numbers, i'm using the latest xampp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.