Hey,

Im designing a website hosting business's website and have a relatively simple whois script which when you enter the website, it checks if it is available then returns some text in a span just under the form.

At the moment the user types in any domain type (.co.uk / .com / .net etc) at the end of the actual domain name, and obviously I need to price the domain according to what type of domain they want. And so i need a script which scans what they entered to try to detect the type of domain they entered and then creates a string with the price of that domain type which i can then write into the document using php, and also the domain type itself.

As it is, I just call the domain name (as the user entered it for example max.com) from forms or hidden fields on the previous pages. These choices (package and domain and then values for their prices) are passed on from page to page using hidden fields.

Quite a lengthy brief so i hope it makes sense!

(http://economizerz.com/ is the website)

Thanks a lot.

Max

Recommended Answers

All 2 Replies

Thanks for the links kvdd.

just incase other people need the script this is what i put together:

<?php
$site = $_REQUEST['site'] ; //gets string value from the field in the form on previous page called site
$sitetwo = stristr($site,'.');  //makes a new string called sitetwo by searching the site string for a "." everything after the first "."

echo "<h1>price: </h1>"; //writes price heading. Delete this line if you want
if ( $sitetwo == ".co.uk" ) {echo "£3";} //if sitetwo string is .co.uk then write £3
if ( $sitetwo == ".com" ) {echo "£4";} //if sitetwo string is .com then write £4
if ( $sitetwo == ".net" ) {echo "£5";} //etc
if ( $sitetwo == ".org" ) {echo "£6";} //etc
if ( $sitetwo == ".me.uk" ) {echo "£7";} 
if ( $sitetwo == ".co.nr" ) {echo "£8";} 
if ( $sitetwo == ".biz" ) {echo "£9";} 
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.