Jump to content

Live domain search box options


Recommended Posts

Hi Guys,

This must be possible what i want to do ?

I want to display a domain search box on my home page with a drop down box listing all the available domain extensions .

Yes i know how to do it manually ;) but surely there is a way that will retreive the available domains from the WHMCS database so that when i add or remove domains in the admin section they are automatically added or removed on my search box ?

It would be just a matter of inserting something from the databse into this line for as many times as there are multiple entries in the database.

 

<option value=".com">.com</option>

 

Oh yeah nearly forgot my website is withing the WHMCS system so it is not external.

 

Any help would be very much appreciated.

 

Justin

Link to comment
Share on other sites

Found the answer if anyone is interested ? :lol:

 

Now you can add a domain search box to your site that has only the domains that you have in the admin section of your WHMCS , so you don't have to edit the <options lines yourself.

Turning 2 jobs into 1

 

In a .tpl file add the following :

 

<form method="post" action="cart.php?a=add&domain=register">

<div class="cartbox" align="center">www.

<input type="text" name="sld" size="40" value="" />

<select name="tld">

{php}

// Make a MySQL Connection

 

function getDomains()

{

$query = mysql_query("SELECT d.id, d.extension 'tld', t.type, c.code, c.suffix, t.msetupfee FROM tbldomainpricing AS d

INNER JOIN tblpricing AS t ON t.relid = d.id

INNER JOIN tblcurrencies AS c ON c.id = t.currency

WHERE t.type IN ('domainregister','domaintransfer','domainrenew') ORDER BY d.id ASC");

$dataArray=array();

while($row = @mysql_fetch_array($query, MYSQL_ASSOC)) {

$dataArray[$row['tld']][$row['type']]=$row;

}

return $dataArray;

}

 

 

$mydata = getDomains();

// echo "<pre>mydata: " . print_r($mydata,TRUE) . "</pre>";

foreach($mydata as $k => $v) { // $k=TLD

 

echo "<option value='". $k ."'>". $k ."</option>";

echo "\n";

}

{/php}

</select>

<input type="submit" value="Check Availability" class="buttongo" />

 

</div>

<p align="center"></p>

</form>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated