tags:

views:

184

answers:

1

Hello, I would like to know how can I add a button to enable user to register the available domain name? My idea is to a button linked to registration page next to the available domain name. When the user click the button, the name of the searched domain will be passed to the next page, which is the registration page.

I've added the following code, but it's not working.

    function showDomainResult($domain,$server,$findText){
   if ($this->tr == 0){
       $this->tr = 1;
       $class = " class='tr2'";
   } else {
       $this->tr = 0;
       $class = "";
   }
   if ($this->checkDomain($domain,$server,$findText)){
      echo "<tr $class><td>$domain</td><td>$this->daftar_tld($domain)</td></tr>";
   }
   else echo "<tr $class><td>$domain</td><td class='tak'>TAKEN</td></tr>";
}

// To display register button
function daftar_tld($domain){
?>
<form method=post action="http://www.com"&gt;
<center><input value=$_POST["$domain"]><input type="submit" name="butangDaftar" class="sbtn" value="Register" /></center>
</form>

<?php    
}

?>

And the output that I get is this (image is provided at the link below):

http://lh5.ggpht.com/_d7N0eqyUoUw/TGgPvCt4B3I/AAAAAAAAAHY/T7e4KjVNT04/Screen%20shot%202010-08-14%20at%2012.53.59%20PM.png

I really hope that someone can help me. I've been working on this for days. Phewwww...

A: 

You haven't set a name or type for the input variable holding the domain:

Your code:

<center><input value=$_POST["$domain"]><input type="submit" name="butangDaftar" class="sbtn" value="Register" /></center>

Suggested code:

<center><input type="hidden" name="domainToRegister" value="<?php echo $_POST["$domain"]; ?>" /><input type="submit" name="butangDaftar" class="sbtn" value="Register" /></center>

The form will then submit the domain as $_POST['domainToRegister'].

Lucanos
Thank you for your answer but the output is still the same.
Eddie
Have you got this code/page available online? It would make it alot easier to review and correct.
Lucanos
Yes I do. The page is at adihafiz.com/domain . Thanks.
Eddie
I have looked at your page, and, for all my testing, it does not seem to be showing any error messages or the like. I have searched for TAKEN and AVAILABLE domains, but I have not seen any buttons shown to allow me to REGISTER them. I can only help test what I can see - and I cannot see anything more here to test.
Lucanos
Ops sorry, that was the working version. I've edited it offline. The codes are available at http://www.adihafiz.com/domain/Archive.zip . Thanks.
Eddie
@Eddie: From a quick look at your source code, it looks like you have declared the `daftar_tld()` function *outside* of the CLASS, hence, any calls to that function, to create the Register button, will fail.
Lucanos
Thanks Lucanos. This question might be silly but I don't know a better way to ask. How do I go about it?
Eddie
The extremely short version? Just move one curly bracket ("`}`") from ABOVE `daftar_tld()` to BELOW it.
Lucanos
It responded with error. :-(
Eddie
I have zipped, and uploaded my modified versions of the files. http://www.filedropper.com/domaincheck You should be able to work from there.
Lucanos