TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Jesus help me dynamic update in drop down (http://www.talkphp.com/general/4254-jesus-help-me-dynamic-update-drop-down.html)

shankar 05-08-2009 07:23 PM

Jesus help me dynamic update in drop down
 
<form action="stud_attendance_report_month.php" name="select_date" method="POST">
View results of &nbsp;&nbsp;&nbsp;
<select name = "month" >
<?php
include("connect.php");

$query = mysql_query("SELECT * FROM stud_attendance WHERE username = 'srikant'");
$numrows = mysql_num_rows($query);
if ($numrows!=0)
{
$row = mysql_fetch_assoc($query);
$id = $row['stud_id'];
$thing = $row['date'];
$set_month = mysql_query("SELECT MONTHNAME('".$thing."') FROM stud_attendance");
$set_month_value = mysql_query("SELECT MONTH('".$thing."') FROM stud_attendance");
}
?>
<option value ="<?php echo $set_month_value;?>"><?php echo $set_month; ?></option>
<?php
}
?>
</select>
&nbsp;&nbsp;&nbsp;

<input id='button' type='submit' name='select_date' value='Submit' />
</form>


Am unable to get the output, it does not display any month name.
Can anybody help me, have to submit the project by evening.

foobarph 05-11-2009 04:11 AM

you did not used FOR statement, of course it will not display anything.

Code:

<form action="stud_attendance_report_month.php" name="select_date" method="POST">

View results of &nbsp;&nbsp;&nbsp;

<select name = "month" >

<?php

include("connect.php");

$query = mysql_query("SELECT * FROM stud_attendance WHERE username = 'srikant'");
$numrows = mysql_num_rows($query);

if ($numrows!=0) {
        $row = mysql_fetch_assoc($query);
        $id = $row['stud_id'];
        $thing = $row['date'];
        $set_month = mysql_query("SELECT MONTHNAME('".$thing."') FROM stud_attendance");
        $set_month_value = mysql_query("SELECT MONTH('".$thing."') FROM stud_attendance");
       
        for ($i=0;$i<=10;$i++) {
       
        ?>
                <option value ="<?php echo $set_month_value;?>"><?php echo $set_month; ?></option>
<?php
        }
} ?>

</select>

&nbsp;&nbsp;&nbsp;

<input id='button' type='submit' name='select_date' value='Submit' />
</form>

I hope you will get some insight from this. :)


All times are GMT. The time now is 05:59 PM.

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