Jump to content

Connect Listbox with Code or combo Box with Code


imrankhan

Recommended Posts

Hi,

1st of all thnx to darghon which make it so simple and easy

 

 

the output for the below code is like:

 

Date                      Tenders

2009-03-08            35

2009-03-09              0

2009-03-10            14

2009-03-11            27

 

 

Now i want  List Box which is embedded in code work with the page to display the record month wise and year wise which user select

code below is in 100% working expect list box function

 

Thanks in advance.

Regards, imran

 

Here is the Code

 

 

<?

$username="******";

$password="******";

$database="*******";

 

mysql_connect(localhost,$username,$password);

@mysql_select_db($database) or die( "Unable to select database");

 

?>

<select name="listmonth">

              <option value="1">January</option>

              <option value="2">February</option>

              <option value="3">March</option>

              <option value="4">April</option>

              <option value="5">May</option>

              <option value="6">June</option>

              <option value="7">July</option>

              <option value="8">August</option>

              <option value="9">September</option>

              <option value="10">October</option>

              <option value="11">November</option>

              <option value="12">December</option>

</select>

             

              <select name="listyear">

              <option value="2009">2009</option>

              <option value="2010">2010</option>

  </select>

  <br /><br />

<table width="305">

<tr><th>Date</th><th>Tenders</th></tr>

<?php 

$query="select distinct advertise_date, count(tender_title) as tenders from ppra_tenders group by advertise_date order by advertise_date asc";

$result = mysql_query($query);

if(mysql_num_rows($result) > 0){

  while($row = mysql_fetch_array($result)){

  ?>

    <tr><td><?php echo $row["advertise_date"]; ?></td><td><?php echo $row["tenders"]; ?></td></tr>

  <?php

  }

}

mysql_free_result($result);

?>

</table>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.