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 8890205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:26:51+00:00 2026-06-14T22:26:51+00:00

In my signup form, I ask users to enter an email with the same

  • 0

In my signup form, I ask users to enter an email with the same domain name as they enter in the url field above.

Right now, I collect data this way:

URL : http://www.domain.com The domain.com part is what the user enters. The http://www is hard coded.

Email : info@ domain.com The bold part is entered by the user. The @ is hard coded.

The domain.com part in the url and domain.com part in the email should match. Right now, I can match the two fields since they are separate.

But I want to give up the above approach and make the user enter the entire domain name and email. When that’s the case, what would be a good way to check if a user entered an email with the same domain he entered in the url field above.

I’m doing all this using php.

  • 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-14T22:26:52+00:00Added an answer on June 14, 2026 at 10:26 pm
        <?php
    
        //extract domain from email
        $email_domain_temp = explode("@", $_POST['email']);
        $email_domain = $email_domain_temp[1];
    
        //extract domain from url
        $url_domain_temp = parse_url($_POST['url']);
        $url_domain = strip_out_subdomain($url_domain_temp['host']);
    
        //compare
        if ($email_domain == $url_domain){
            //match
        }
    
        function strip_out_subdomain($domain){
            //do nothing if only 1 dot in $domain
            if (substr_count($domain, ".") == 1){
                 return $domain;
            }
            $only_my_domain = preg_replace("/^(.*?)\.(.*)$/","$2",$domain);
            return $only_my_domain;
        }
    

    So what this does is :

    First, split the email string in 2 parts in an array. The second part is the domain.

    Second, use the php built in function to parse the url, then extract the “host”, while removing the (optionnal) subdomain.

    Then compare.

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

Sidebar

Related Questions

I have email field in signup form , I want to validate email domain
I have a signup form where users kan enter their subdomain of choice when
I have a signup form posting to my customers_controller, but now they want the
Simple scenario: I have a signup form, with user name, password, email address, may
i have one signup form where i have three field username,password and email address
On a standard web signup form, users are required to have a unique email
I have a signup form with 3 fields: Username Email Password On most browsers
I use a XMLHttpRequest on a signup form to see if the username they
I have a simple user signup form with a checkbox that lets users get
I'm working on an email series signup form that needs to have a checkbox

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.