TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Dynamic drop-down help!! (http://www.talkphp.com/general/4494-dynamic-drop-down-help.html)

shankar 06-07-2009 11:58 AM

Dynamic drop-down help!!
 
<form action="stud_attendance_report_month.php" name="select_date" method="POST">

<select name = "month" >
<option value = "0">Select one</option>
<?php
$query2 = mysql_query("SELECT * FROM attendance WHERE Stud_ID = '1'");
$numrows2 = mysql_num_rows($query2);
if ($numrows2!=0)
{
$row2 = mysql_fetch_assoc($query2);
$thing = $row2['att_date'];

$get_rows = mysql_query("SELECT att_date FROM attendance");
$month_rows = mysql_query("SELECT MONTHNAME('".$thing."') FROM attendance");
$set_month_name = date("M",strtotime(".$thing."));
$set_month_value = date("m",strtotime(".$thing."));
$assis_count = mysql_num_rows($get_rows);
$month_count = mysql_num_rows($month_rows);


?>
<option value ="<?php echo $set_month_value;?>"><?php echo $month_name." - ".$load_year; ?></option>
<?php
}
?>
</select>

There are 3 month names added Apr,May,Jun in the table of attendance, but in the drop-down there is only May that is displayed but not the actual names that are available in the database, help me..

wjgilmore 06-11-2009 10:05 PM

Hi Shankar,

Seems you're missing the looping mechanism for inserting each month into the <option> tag?

Jason

rguy84 06-15-2009 07:04 AM

Quote:

Originally Posted by wjgilmore (Post 25255)
Hi Shankar,

Seems you're missing the looping mechanism for inserting each month into the <option> tag?

Jason

Yep, that is what he needs.


All times are GMT. The time now is 02:49 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0