justinsmithies Posted October 5, 2010 Share Posted October 5, 2010 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 0 Quote Link to comment Share on other sites More sharing options...
justinsmithies Posted October 5, 2010 Author Share Posted October 5, 2010 Found the answer if anyone is interested ? 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> 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.