Page 1 of 1

PHP/HTML/MySQL issue HELP???

Posted: Thu Jul 02, 2009 4:21 pm
by DagasSiren
i am quite sure this has been asked before... but me being the moron i am, i can't find my exact issue... so here it goes.

what i am trying to do is use an HTML "<SELECT>" that grabs the dates from a specific db table in MySQL. so... here is the code that i have currently...

Code: Select all

 
/*********************************************************
 ** THIS SECTION TO RETRIEVE DATE AND FILL OPTIONS BOX **
 *********************************************************/
 echo "<HTML>\n<BODY>\n";
 echo "<TABLE align=\"center\" width=\"75%\" border=\"3\">\n<TR>\n";
 echo " <TD align=\"right\" width=\"50%\">PLEASE SELECT DATE:&nbsp; </TD>\n";
 echo " <TD align=\"left\" width=\"50%\">\n";
 echo " <SELECT name=\"datedropdown\" size=\"1\">\n";
            $connect=mysql_connect('localhost',$us,$pa);
            @mysql_select_db($db) or die("Unable to connect to requested Database...");
 
            $date_query=("SELECT date FROM nondenom ORDER BY date asc");
            $date_result=mysql_query($date_query) or die ("Unable to Make the Query:" . mysql_error() );
            $row_num=mysql_numrows($date_result);
 
            $a = 0;
            while ( $a < $row_num )
            {
                $row_date=mysql_fetch_assoc($date_result);
                $showdate = $row_date['date'];
                $dateid = $a;
                echo "<OPTOIN value=\"" . $dateid . "\">";
                echo $showdate;
                echo "\n";
                $a++;
            }
            echo "</OPTION>\n";
            mysql_close();
echo "</SELECT>\n</TD>\n</TR>\n</TABLE>\n\n</BODY>\n</HTML>";
 
and while that looks right to me... i am sure i am doing something wrong... BECAUSE... the select box in my html page shows nothing in there...
BUT!!!!!!!!! and this is a big BUT!!!!!!!

when i do a "View Source" on the HTML page, this is what i get....

Code: Select all

 
<HTML>
<BODY>
<TABLE align="center" width="75%" border="3">
<TR>
    <TD align="right" width="50%">PLEASE SELECT DATE:&nbsp; </TD>
    <TD align="left" width="50%">
    <SELECT name="datedropdown" size="1">
<OPTOIN value="0">2009-07-01
<OPTOIN value="1">2009-07-02
</OPTION>
    </SELECT>
 
</TD>
</TR>
</TABLE>
 
</BODY>
</HTML>
 
SOOOO..... my database part is working... the fetching is working... as you can see it is producing the correct HTML as far as i can find on the web.... but still the "SELECT" box shows nothing in it....


any suggestions?

thanks in advance for your help...


DagasSiren...

Re: PHP/HTML/MySQL issue HELP???

Posted: Thu Jul 02, 2009 5:59 pm
by requinix

Code: Select all

<OPTOIN value="0">2009-07-01
Look a litlte haredr at the HTML you generaetd.

Re: PHP/HTML/MySQL issue HELP???

Posted: Thu Jul 02, 2009 7:57 pm
by DagasSiren
see... told you i was a moron... ok no more coding for me after only 2 hours of sleep...

thank you sooooooooooo much :)

Re: PHP/HTML/MySQL issue HELP???

Posted: Thu Jul 02, 2009 9:35 pm
by jackpf
Lols.