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>
Or with regexp
Edit: