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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:16:22+00:00 2026-05-18T08:16:22+00:00

I have a an input box on my homepage which i want users to

  • 0

I have a an input box on my homepage which i want users to input their domain to search for .
E.G.

test.com

or

test.gb.com

etc and i would like it to on submission ( post ) to extract the everything upto the first “.” into a variable $domain and everything after the first including “.” into $ext

So $domain might now contain “test” and $ext would contain “.gb.com” When the form was posted.

Possible ?

Here is the code for my form so far . What i need is to have everything that is inputted upto the first “.” stored in the name=”domain” form variable and everything in this line

i.e from the $ext variable stored for the form submission

Code so far :

<form method="post" action="https://www.jms-networks.net/domainchecker.php">
<span class="text"><input value="{php} print $_POST['sld'] ? $_POST['sld'] : 'Search for your domain name'; {/php}" type="text" name="domain" class="searchbox" onfocus="if (this.value == this.defaultValue) this.value = '';" onblur="if (this.value == '') this.value = this.defaultValue;" /></span>
<input type="hidden" name="direct" value="true" />
<!-- This one below should contain the $ext value everythign after including the first "." -->
<input type="hidden" name="tlds[]" value="what goes here???" />
<input type="hidden" name="tlds[]" value=".me.uk" />
<input type="hidden" name="tlds[]" value=".org.uk" />
<input type="hidden" name="tlds[]" value=".com" />
<input type="hidden" name="tlds[]" value=".net" />
<input type="hidden" name="tlds[]" value=".org" />

<input type="submit" value="Go" class="product-headers" />
</form>
  • 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-05-18T08:16:22+00:00Added an answer on May 18, 2026 at 8:16 am
    var i = $thewhole.indexOf('.');
    var $domain = $thewhole.substr(0, i);
    var $ext = $thewhole.substr(i);
    

    Or with regexp

    var regexp = /([^.]+)(\..*)/;
    var match = regexp.exec($thewhole);
    var $domain = match[1];
    var $ext = match[2];
    

    Edit:

    <script type="text/javascript">
    
        function submithelper() {
    
          // this is why we need the id="xxx" below.
          var $domainInput = document.getElementById("domain");
          var $extInput = document.getElementById("ext");
    
          var $domain = $domainInput.value;
          var $i = $domain.indexOf('.'); 
          var $host = $domain.substr(0, $i); // perhaps skip to do this if it isn't used?
          var $ext = $domain.substr($i);          
    
          $extInput.value = $ext;
    
          return true; // false to stop form from submitting.
        }
    
    </script>
    
    <form onsubmit="return submithelper()" method="post" action="https://www.jms-networks.net/domainchecker.php">
    
      <!-- Two inputs has been given IDs so we can easily get them from javascript. -->
    
      <span class="text"><input id="domain" value="{php} print $_POST['sld'] ? $_POST['sld'] : 'Search for your domain name'; {/php}" type="text" name="domain" class="searchbox" onfocus="if (this.value == this.defaultValue) this.value = '';" onblur="if (this.value == '') this.value = this.defaultValue;" /></span>
      <input type="hidden" name="direct" value="true" />
      <input id="ext" type="hidden" name="tlds[]" value="" />
      ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a input box which looks like below, <input id=basic-search type=text value=Enter keyword
I have an input box which is limited to 16 Numbers. What I'd like
I have an input box which I want to handle two types of information,
id like to have an input box that a user can enter a search
I have an input box. On mouseover, I would like a list is to
I have an input box $myInput = $('<input/>').val('Some text') . I would like to
I have a input box, and I would like to use vbscript or javascript
I have a input box which it's for email accounts, it's bg-image is @mydomain.com
I have an input box <input type=text name=search id=search /> <img src=icon.png alt= id=doSearch
I have an input box that takes values from 0-100. I want to prevent

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.