Radio buttons, select menus, etc. in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
This is a more general PHP question: can someone point me to a good tutorial
on how to make these HTML selection devices work in PHP.  I can make the
code below work, but I am not quite certain what I am doing (I understand
what¹s going on up to the if statement).

Thanks, Jason


function GetGenOpts ($aTableName, $column_name, $aCurSel = "")
{
    /* Connecting, selecting database */
    $link = mysql_connect("localhost", "root", "jewcrew")
        or die("Could not connect");
    print "Connected successfully";
    mysql_select_db("oysterqtl", $link) or die("Could not select database");

    /* Performing SQL query */
    
        $aResult = "";
        $aSQL = mysql_query("select distinct $column_name from $aTableName",
$link);
        
        while ($this_column = mysql_fetch_array ($aSQL))
        {
            $aMother = $this_column[0];
            $aID = $this_column[0];
            if ($aID == $aCurSel)
            {
                $aResult .= "<option value=\"$aMother\"
selected>$aMother</option>";
            }
            else
            {
                $aResult .= "<option value=\"$aMother\">$aMother</option>";
            }
        }
        return $aResult;
    }  
-- 
Jason P. Curole, Postdoctoral Researcher
Bodega Marine Lab, University of California
Bodega Bay CA 94923

Office: (707) 875-2077
Lab: (707) 875-2076
Fax: (707) 875-2089

Shipping:
2099 Westshore Rd.



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux